feat(mcp): add project context caching via MCP tools#296
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
1. DB Migration (
internal/db/sqlite.go)contextcolumn toprojectstable for auto-generated context storage2. DB Methods (
internal/db/tasks.go)GetProjectContext(projectName string)- retrieves cached contextSetProjectContext(projectName string, context string)- saves context3. MCP Tools (
internal/mcp/server.go)workflow_get_project_contexttool - returns cached context for current task's projectworkflow_set_project_contexttool - saves context to the project4. Task Prompt Update (
internal/executor/executor.go)buildPrompt()to instruct Claude to use context cachingFlow
workflow_get_project_contextworkflow_set_project_contextTest plan
TestProjectContext)TestWorkflowGetProjectContext,TestWorkflowSetProjectContext)go test ./...)go build ./...)🤖 Generated with Claude Code