4 ms·
In my Coding Agent, I ended up realizing my prompts need to be able to specifically mention very specific areas in the code, for which no real good syntax exist
by quantadev 2y ago
In my Coding Agent, I ended up realizing my prompts need to be able to specifically mention very specific areas in the code, for which no real good syntax exists for doing that so I invented something I call "Named Blocks".
My coding agent allows you to put any number of named blocks in your code and then mention those in your prompts by name, and the AI understands what code you mean. Here's an example:
In my code:
-- block_begin SQL_Scripts
...some sql scripts...
-- block_end
Example prompt:
Do you see any bugs in block(SQL_Script)?
- mdaniel 2y ago> for which no real good syntax exists for doing that Up to you, but several editors have established syntax which any code-trained model will likely have seen plenty of examples vim (set foldmethod=marker and then {{{ begin\n }}} end\n ) https://vimdoc.sourceforge.net/htmldoc/usr_28.html#28.6 https://vimdoc.sourceforge.net/htmldoc/usr_28.html#28.6> JetBrains <editor-fold desc=""></editor-fold> https://www.jetbrains.com/help/idea/working-with-source-code.html#custom_folding_regions https://www.jetbrains.com/help/idea/working-with-source-code... Visual Studio (#pragma region) https://learn.microsoft.com/en-us/cpp/preprocessor/region-endregion?view=msvc-170 https://learn.microsoft.com/en-us/cpp/preprocessor/region-en... (et al, each language has its own)
- quantadev 2y agoThe great thing about my agent, which I left out, is that it extracts out all the named blocks using just pure Python, so that the prompt itself has them embedded directly in it. That's faster and more efficient than even having a "tool call" that extracts blocks by name. So I needed a solution where my own code can get named block content out of any kind of file. Having one syntax that works on ALL types of files was ideal. UPDATE: In other words it's always "block_begin" "block_end" regardless of what the comment characters are which will be different for different files of course.