Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 3, 2026

Summary

Port Platform Network's top-agent system prompts to Cortex prompt harness.

Source: Top Agent from Term Challenge - ranked top with 11/15 challenges completed.

Changes

  • Add top_agent.rs module with system prompt constants
  • Implement TopAgentPromptBuilder for fluent prompt construction
  • Add TopAgentPresets: coding_assistant, research_assistant, code_reviewer, minimal
  • Add tool mapping constants (read_file → Read, write_file → Write, etc.)
  • Export new types from the prompts module

Testing

  • 23 unit tests covering all functionality
  • All tests passing

Compatibility

Fully compatible with existing prompt system - no breaking changes.

@greptile-apps
Copy link

greptile-apps bot commented Feb 3, 2026

Greptile Overview

Greptile Summary

This PR successfully integrates Platform Network's top-agent autonomous coding prompts into the Cortex prompt harness system, providing a comprehensive and well-structured addition to the codebase.

Key Changes

  • New module top_agent.rs (~1,828 lines) with 23 modular prompt sections covering autonomous operation, backup-first data safety, process management, and workspace cleanup
  • Fluent builder API (TopAgentPromptBuilder) enabling dynamic prompt construction with section toggling, variable substitution, and capability contexts
  • Six curated presets for common use cases: coding assistant, research assistant, code reviewer, minimal, data safety, and process management
  • Tool mapping documentation showing conceptual mapping between top-agent and Cortex tools
  • Comprehensive test suite with 23 unit tests covering all builder methods, presets, and tool mappings
  • Clean integration into existing prompt harness via mod.rs with proper re-exports

Code Quality

  • Well-documented with detailed rustdoc comments and usage examples
  • Consistent with existing Cortex patterns (similar to CortexPromptBuilder)
  • Thorough test coverage ensures reliability
  • Clear separation of concerns with modular section constants
  • #[must_use] annotations on builder methods prevent accidental dropped values

Confidence Score: 5/5

  • This PR is safe to merge - it's a pure additive feature with no breaking changes
  • Score reflects high-quality implementation with comprehensive tests, excellent documentation, clean integration, and no impact on existing code
  • No files require special attention

Important Files Changed

Filename Overview
src/cortex-prompt-harness/src/prompts/top_agent.rs Adds comprehensive top-agent prompt system with 23 modular sections, builder API, and 6 presets
src/cortex-prompt-harness/src/prompts/mod.rs Integrates top_agent module with proper documentation and re-exports

Sequence Diagram

sequenceDiagram
    participant User
    participant Cortex
    participant TopAgentPrompts
    participant Builder
    participant Presets

    User->>Cortex: Request top-agent prompt
    Cortex->>TopAgentPrompts: Import module
    
    alt Use Preset
        Cortex->>Presets: coding_assistant()
        Presets->>Builder: new()
        Builder->>Builder: Load 23 sections
        Presets->>Builder: with_code_execution()
        Presets->>Builder: with_file_operations()
        Builder->>Presets: build() → prompt string
        Presets->>Cortex: Return preset prompt
    else Custom Build
        Cortex->>Builder: new()
        Builder->>Builder: Load all sections (enabled)
        Cortex->>Builder: without_section("CLEANUP")
        Builder->>Builder: Disable section
        Cortex->>Builder: with_variable("key", "val")
        Builder->>Builder: Store variable
        Cortex->>Builder: build()
        Builder->>Builder: Filter enabled sections
        Builder->>Builder: Apply variable substitution
        Builder->>Builder: Join sections with separators
        Builder->>Cortex: Return custom prompt
    else Direct Access
        Cortex->>TopAgentPrompts: TOP_AGENT_SYSTEM_PROMPT
        TopAgentPrompts->>Cortex: Return full prompt constant
    end
    
    Cortex->>User: Provide configured prompt
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Port Platform Network's top-agent system prompts to Cortex CLI:
- Add top_agent.rs with full system prompt and section constants
- TopAgentPromptBuilder for dynamic prompt construction
- TopAgentPresets for coding_assistant, research_assistant, code_reviewer, minimal
- Tool mapping constants (read_file→Read, write_file→Write, etc.)
- 23 unit tests covering all functionality
@echobt echobt force-pushed the feature/top-agent-prompts-integration branch from 9dd0557 to 973f9ab Compare February 3, 2026 20:10
@echobt echobt changed the title feat: Add Platform Network top-agent prompts integration feat(cortex-prompt-harness): add top-agent prompts integration Feb 3, 2026
…p-agent prompts

- Remove SECTION_WORKSPACE_CLEANUP constant and all references
- Remove WORKSPACE_CLEANUP from TOP_AGENT_SECTION_NAMES array
- Remove WORKSPACE_CLEANUP from TopAgentPromptBuilder sections
- Remove .without_section("WORKSPACE_CLEANUP") from presets
- Update module documentation
- Update tests that referenced WORKSPACE_CLEANUP

All sections are now unconditionally included in the system prompt.
…sections

- Remove conditional capability context checks (code_execution, file_operations, web_search flags)
- Add CODE_EXECUTION, FILE_OPERATIONS, and WEB_SEARCH_CAPABILITY as proper sections
- All capability contexts are now treated as sections that can be enabled/disabled
- No more 'if keyword in prompt' patterns - all prompts are in the system prompt directly
- Maintain backward compatibility with with_code_execution(), with_file_operations(), with_web_search() methods
echobt added a commit that referenced this pull request Feb 3, 2026
- Add top_agent.rs with TopAgentPromptBuilder, TopAgentPresets, and ~20 section constants
- Update mod.rs to include top_agent module and re-export public types
- Integrates PR #20's top-agent prompts into PR #21's skill-based architecture
echobt added a commit that referenced this pull request Feb 3, 2026
feat(prompts): implement skill-based dynamic prompt architecture

This PR transforms the monolithic system prompt architecture into a modular skill-based system where the agent loads specialized skills on-demand based on task requirements. This reduces context window usage by only including relevant instructions.

Changes:
- Add builtin_skills.rs with six built-in skills (git, code-quality, file-operations, debugging, security, planning)
- Add base_agent.rs with minimal base prompt and skill loading mechanism
- Integrate skill system with prompt builder in cortex-engine
- Add built-in skill support to UseSkill handler
- Integrate top_agent module from PR #20

Benefits:
- Reduced context usage (~500 tokens base vs ~2000+ monolithic)
- Modular updates: skills can be updated independently
- Clear organization: instructions organized by domain
- Backward compatible: original monolithic prompt still available

Testing: 200+ tests covering all new functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant