Skip to content

Agent: replace push-based strategic docs with pull-based tool access #132

@federiconeri

Description

@federiconeri

Summary

Replace the current approach of injecting all strategic documents into the agent's system prompt (push-based) with a tool that lets the agent read specific documents on demand (pull-based), reducing per-turn context size.

Problem / Context

The current prepareStep() in src/agent/orchestrator.ts injects memory entries filtered by category into every agent turn. With strategic docs (design.md at 15K tokens, implementation-plan.md at 15K tokens, guides totaling ~7K tokens), this adds ~37K tokens to every turn's context.

Over 180 turns, that's 6.7M tokens of repeated strategic doc content that the agent may only reference occasionally.

Proposed Solution

This was already implemented in commit 2d047b2 (feat(agent): replace push-based strategic docs with pull-based tool access). Verify the implementation is working correctly and producing the expected token savings.

The approach:

  1. Remove strategic doc injection from prepareStep()
  2. Add a readProjectDoc tool that lets the agent fetch specific docs when needed
  3. Agent's system prompt mentions available docs but doesn't include their content

Acceptance Criteria

  • Strategic docs not injected into every turn
  • Agent can read specific docs via tool when needed
  • Per-turn context size reduced by ~30K tokens
  • Agent still has access to all strategic information when needed

Metadata

Metadata

Assignees

Labels

ai/llmAI workflows, agents, promptsenhancementEnhancement to existing feature

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions