Commit a16537e
authored
feat: Dynamic system prompt architecture with cortex-prompt-harness (#8)
* feat(prompt-harness): add dynamic tool injection support
- Add ToolDefinition struct to context.rs with name, description, and optional category
- Add tools field to PromptContext with add_tool() and with_tools() builder methods
- Add build_dynamic_tools_section() function to sections.rs for markdown table rendering
- Add with_tools() method to SystemPromptBuilder in builder.rs
- Export ToolDefinition from lib.rs
- Add comprehensive tests for all new functionality
Tools are rendered as markdown tables, grouped by category when provided.
* feat(prompt-harness): add CortexPromptBuilder for dynamic prompt construction
- Add individual section constants extracted from CORTEX_MAIN_PROMPT:
- SECTION_HEADER, SECTION_PRIME_DIRECTIVES, SECTION_COGNITIVE_ARCHITECTURE
- SECTION_FAILURE_PROTOCOL, SECTION_CODE_DISCIPLINE, SECTION_QUALITY_CHECKPOINTS
- SECTION_TOOLKIT, SECTION_RESPONSE_PATTERNS, SECTION_ANTI_PATTERNS, SECTION_OUTPUT_FORMAT
- SECTION_NAMES constant listing all section names
- Implement CortexPromptBuilder with fluent API:
- new() creates builder with all default sections enabled
- without_section() / with_section() to toggle sections
- add_tool() / with_tools() to add custom tools to toolkit
- with_custom_toolkit() to replace default toolkit entirely
- add_custom_section() to append custom sections
- is_section_enabled() / enabled_sections() for introspection
- build() / build_with_token_estimate() for final output
- Keep CORTEX_MAIN_PROMPT unchanged for backward compatibility
- Add 24 comprehensive tests for the new builder
- Export new types from prompts module
* refactor(cortex-engine): use cortex-prompt-harness for system prompt
* chore: remove cortex_prompt.txt (now in cortex-prompt-harness)
- Remove cortex_prompt.txt from repository root
- Update documentation in core.rs to reflect new architecture
- System prompt is now centralized in cortex-prompt-harness crate
The prompt content is now the canonical source in:
cortex_prompt_harness::prompts::CORTEX_MAIN_PROMPT1 parent f0bdd20 commit a16537e
11 files changed
Lines changed: 1297 additions & 277 deletions
File tree
- src
- cortex-engine
- src
- prompt
- session
- cortex-prompt-harness/src
- prompts
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
0 commit comments