Skip to content

feat(mcp): add project context caching via MCP tools#296

Merged
bborn merged 2 commits intomainfrom
task/767-add-project-context-caching-via-mcp
Jan 31, 2026
Merged

feat(mcp): add project context caching via MCP tools#296
bborn merged 2 commits intomainfrom
task/767-add-project-context-caching-via-mcp

Conversation

@bborn
Copy link
Copy Markdown
Owner

@bborn bborn commented Jan 31, 2026

Summary

  • Add auto-generated project context caching that executors can read/write via MCP
  • Eliminates the need for Claude to explore the codebase on every task startup
  • Future tasks instantly get cached context, significantly speeding up task execution

Changes

1. DB Migration (internal/db/sqlite.go)

  • Added context column to projects table for auto-generated context storage

2. DB Methods (internal/db/tasks.go)

  • Added GetProjectContext(projectName string) - retrieves cached context
  • Added SetProjectContext(projectName string, context string) - saves context

3. MCP Tools (internal/mcp/server.go)

  • Added workflow_get_project_context tool - returns cached context for current task's project
  • Added workflow_set_project_context tool - saves context to the project

4. Task Prompt Update (internal/executor/executor.go)

  • Updated buildPrompt() to instruct Claude to use context caching

Flow

  1. Task starts → Claude calls workflow_get_project_context
  2. If context exists → Claude uses it, skips exploration
  3. If empty → Claude explores once, calls workflow_set_project_context
  4. Future tasks get cached context instantly

Test plan

  • Run new unit tests for DB methods (TestProjectContext)
  • Run new unit tests for MCP tools (TestWorkflowGetProjectContext, TestWorkflowSetProjectContext)
  • Run full test suite (go test ./...)
  • Verify build succeeds (go build ./...)
  • Manual test: Start a task in a project without context, verify exploration happens
  • Manual test: Start another task in the same project, verify cached context is used

🤖 Generated with Claude Code

bborn and others added 2 commits January 31, 2026 06:46
Add auto-generated project context that executors can read/write via MCP,
eliminating the need for exploration on every task startup.

Changes:
- Add `context` column to projects table (auto-generated, not user-facing)
- Add GetProjectContext/SetProjectContext DB methods
- Add workflow_get_project_context MCP tool to retrieve cached context
- Add workflow_set_project_context MCP tool to save exploration results
- Update task prompt to instruct Claude to use context caching

Flow:
1. Task starts → Claude calls workflow_get_project_context
2. If context exists → Claude uses it, skips exploration
3. If empty → Claude explores once, saves via workflow_set_project_context
4. Future tasks get cached context instantly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests the complete flow:
1. First task gets empty context
2. First task saves context after exploration
3. Second task in same project gets cached context
4. Verifies context persists in database

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bborn bborn merged commit 13b2908 into main Jan 31, 2026
3 checks passed
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