feat(agents): Integrate 18 Cipher MCP tools across all 8 MAP agents#38
feat(agents): Integrate 18 Cipher MCP tools across all 8 MAP agents#38
Conversation
Enhanced all MAP Framework agents to leverage available MCP tools for: - Reasoning memory (search/store/extract/evaluate reasoning patterns) - Knowledge graph (dependency tracking, impact analysis) - Intelligent processing (entity extraction, conflict detection) - Cross-project learning (cipher sync with deduplication) Changes by agent: **task-decomposer.md**: - Added cipher_search_reasoning_patterns as tool #2 - Learn from HOW successful decompositions were reasoned - Comprehensive examples showing WHY vs WHAT learning **actor.md**: - Added 6-step decision tree for tool selection - Added 3 Tool Combination Scenarios (JWT, WebSocket, caching) - Detailed examples for context7, deepwiki, codex-bridge usage **monitor.md**: - Added cipher_search_graph for dependency understanding - Added cipher_get_neighbors for tracing chains - Added cipher_add_node/add_edge for recording validation results **predictor.md**: - Added knowledge graph tools for impact analysis - Added cipher_intelligent_processor for NL impact statements - Integrated graph traversal for dependency chains **evaluator.md**: - Added cipher_search_reasoning_patterns - Learn from past evaluation reasoning patterns **reflector.md**: - Added 4 reasoning memory tools: - cipher_search_reasoning_patterns - cipher_store_reasoning_memory - cipher_extract_reasoning_steps - cipher_evaluate_reasoning - Enables meta-learning from reasoning processes **curator.md**: - Added cipher_intelligent_processor for entity extraction - Enhanced cipher_extract_and_operate_memory with: - Improved confidence thresholds (0.85 similarity, 0.7 confidence) - enableDeleteOperations: false to prevent accidents - Added comprehensive deduplication examples **Template Sync**: All changes synchronized to src/mapify_cli/templates/agents/ Verified with scripts/check-template-sync.sh **Key Benefits**: - Deduplication: Search cipher before creating knowledge - Meta-learning: Learn HOW problems are solved - Knowledge graph: Track dependencies and analyze impact - Cross-project: Share proven patterns (helpful_count >= 5) - Current docs: context7 ensures up-to-date library APIs Dual memory system (Playbook + Cipher) now fully operational!
There was a problem hiding this comment.
Pull Request Overview
This PR enhances all 8 MAP Framework agents by integrating 18 Cipher MCP tools to enable reasoning memory, knowledge graph operations, intelligent processing, and cross-project learning capabilities. The changes establish a dual memory system (Playbook + Cipher) with deduplication strategies and meta-learning capabilities.
- Added reasoning pattern search tools to enable learning from the "how" and "why" behind successful implementations
- Integrated knowledge graph tools for dependency tracking and impact analysis
- Added intelligent processor for automated entity extraction and conflict detection
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.claude/agents/task-decomposer.md |
Added cipher_search_reasoning_patterns tool to learn decomposition thinking processes with comprehensive examples |
.claude/agents/actor.md |
Added 6-step decision tree for MCP tool selection and 3 tool combination scenarios, but contains incorrect Next.js API usage example |
.claude/agents/monitor.md |
Added knowledge graph tools (cipher_search_graph, cipher_get_neighbors, cipher_add_node/add_edge) for dependency tracking |
.claude/agents/predictor.md |
Added knowledge graph tools for impact analysis but has inconsistent step numbering in decision framework |
.claude/agents/evaluator.md |
Added cipher_search_reasoning_patterns to learn from past evaluation reasoning |
.claude/agents/reflector.md |
Added 4 reasoning memory tools for meta-learning capabilities |
.claude/agents/curator.md |
Added cipher_intelligent_processor and enhanced deduplication examples with proper configuration |
src/mapify_cli/templates/agents/task-decomposer.md |
Template synchronized with agent changes |
src/mapify_cli/templates/agents/actor.md |
Template synchronized with agent changes, includes same API error |
src/mapify_cli/templates/agents/monitor.md |
Template synchronized with agent changes |
src/mapify_cli/templates/agents/predictor.md |
Template synchronized with agent changes, includes same numbering issue |
src/mapify_cli/templates/agents/evaluator.md |
Template synchronized with agent changes |
src/mapify_cli/templates/agents/reflector.md |
Template synchronized with agent changes |
src/mapify_cli/templates/agents/curator.md |
Template synchronized with agent changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| IF external library involved: | ||
| 3. THEN → get-library-docs (compatibility check) | ||
| 5. THEN → get-library-docs (compatibility check) |
There was a problem hiding this comment.
The numbering sequence in the Tool Selection Decision Framework has an inconsistency. Step 5 is assigned to "get-library-docs" at line 94, but later in the framework (lines 99-108, outside the diff), there's another step 4 (deepwiki) and step 5 (Grep/Glob). Consider using step 6 for get-library-docs to avoid the duplicate numbering that occurs later in the framework.
| 5. THEN → get-library-docs (compatibility check) | |
| 6. THEN → get-library-docs (compatibility check) |
|
|
||
| IF external library involved: | ||
| 3. THEN → get-library-docs (compatibility check) | ||
| 5. THEN → get-library-docs (compatibility check) |
There was a problem hiding this comment.
The numbering sequence in the Tool Selection Decision Framework has an inconsistency. Step 5 is assigned to "get-library-docs" at line 94, but later in the framework (lines 99-108, outside the diff), there's another step 4 (deepwiki) and step 5 (Grep/Glob). Consider using step 6 for get-library-docs to avoid the duplicate numbering that occurs later in the framework.
| 5. THEN → get-library-docs (compatibility check) | |
| 6. THEN → get-library-docs (compatibility check) |
| - Response.next() replaces old NextResponse (BREAKING CHANGE) | ||
|
|
||
| 3. Implement using CURRENT API: | ||
| ```typescript | ||
| // middleware.ts | ||
| export const config = { | ||
| matcher: '/api/:path*', // NEW syntax | ||
| } | ||
|
|
||
| export function middleware(request: Request) { | ||
| return Response.next(); // CURRENT API | ||
| } | ||
| ``` | ||
|
|
||
| 4. Implementation benefited from current docs: | ||
| - Used correct v14 syntax (not outdated v12 from training) | ||
| - Avoided deprecated APIs (NextResponse) |
There was a problem hiding this comment.
The Next.js middleware example contains an incorrect API usage. Next.js middleware should return NextResponse.next() (from 'next/server'), not Response.next(). The standard Response object doesn't have a next() method. The correct import and usage should be:
import { NextResponse } from 'next/server'
export function middleware(request: Request) {
return NextResponse.next()
}This contradicts the comment on line 188 and 204 which claim NextResponse is deprecated, but NextResponse is still the correct API in Next.js 13+ and 14.
| - Response.next() replaces old NextResponse (BREAKING CHANGE) | |
| 3. Implement using CURRENT API: | |
| ```typescript | |
| // middleware.ts | |
| export const config = { | |
| matcher: '/api/:path*', // NEW syntax | |
| } | |
| export function middleware(request: Request) { | |
| return Response.next(); // CURRENT API | |
| } | |
| ``` | |
| 4. Implementation benefited from current docs: | |
| - Used correct v14 syntax (not outdated v12 from training) | |
| - Avoided deprecated APIs (NextResponse) | |
| - Use NextResponse.next() from 'next/server' (CURRENT API in v13+ and v14) | |
| 3. Implement using CURRENT API: | |
| ```typescript | |
| // middleware.ts | |
| import { NextResponse } from 'next/server' | |
| export const config = { | |
| matcher: '/api/:path*', // NEW syntax | |
| } | |
| export function middleware(request: Request) { | |
| return NextResponse.next(); // CURRENT API | |
| } |
- Implementation benefited from current docs:
- Used correct v14 syntax (not outdated v12 from training)
- Used correct API (NextResponse is not deprecated)
| - Response.next() replaces old NextResponse (BREAKING CHANGE) | ||
|
|
||
| 3. Implement using CURRENT API: | ||
| ```typescript | ||
| // middleware.ts | ||
| export const config = { | ||
| matcher: '/api/:path*', // NEW syntax | ||
| } | ||
|
|
||
| export function middleware(request: Request) { | ||
| return Response.next(); // CURRENT API | ||
| } | ||
| ``` | ||
|
|
||
| 4. Implementation benefited from current docs: | ||
| - Used correct v14 syntax (not outdated v12 from training) | ||
| - Avoided deprecated APIs (NextResponse) |
There was a problem hiding this comment.
The Next.js middleware example contains an incorrect API usage. Next.js middleware should return NextResponse.next() (from 'next/server'), not Response.next(). The standard Response object doesn't have a next() method. The correct import and usage should be:
import { NextResponse } from 'next/server'
export function middleware(request: Request) {
return NextResponse.next()
}This contradicts the comment on line 188 and 204 which claim NextResponse is deprecated, but NextResponse is still the correct API in Next.js 13+ and 14.
| - Response.next() replaces old NextResponse (BREAKING CHANGE) | |
| 3. Implement using CURRENT API: | |
| ```typescript | |
| // middleware.ts | |
| export const config = { | |
| matcher: '/api/:path*', // NEW syntax | |
| } | |
| export function middleware(request: Request) { | |
| return Response.next(); // CURRENT API | |
| } | |
| ``` | |
| 4. Implementation benefited from current docs: | |
| - Used correct v14 syntax (not outdated v12 from training) | |
| - Avoided deprecated APIs (NextResponse) | |
| - Use NextResponse.next() from 'next/server' for middleware return value (CURRENT API) | |
| 3. Implement using CURRENT API: | |
| ```typescript | |
| // middleware.ts | |
| import { NextResponse } from 'next/server' | |
| export const config = { | |
| matcher: '/api/:path*', // NEW syntax | |
| } | |
| export function middleware(request: Request) { | |
| return NextResponse.next(); // CURRENT API | |
| } |
- Implementation benefited from current docs:
- Used correct v14 syntax (not outdated v12 from training)
- Used correct API (NextResponse.next()) per official docs
Fixed issues identified by Copilot PR reviewer:
**predictor.md**:
- Fixed inconsistent step numbering in Tool Selection Decision Framework
- Changed step 5 (get-library-docs) → step 6
- Changed step 4 (deepwiki) → step 7
- Changed step 5 (Grep/Glob) → step 8
- Eliminates duplicate numbering and maintains logical sequence
**actor.md**:
- Fixed incorrect Next.js middleware API usage
- Verified with context7: NextResponse.next() is CURRENT API (not deprecated)
- Corrected Response.next() → NextResponse.next() with proper import
- Added missing import: import { NextResponse } from 'next/server'
- Updated comments to reflect correct API usage per official Next.js v14 docs
**Verification**:
- Used mcp__context7__get-library-docs to verify Next.js middleware API
- Consulted /vercel/next.js official repository (Trust Score: 10)
- Confirmed NextResponse.next() is the correct API for middleware in v13+ and v14
**Template Sync**:
- Both agent files synchronized to src/mapify_cli/templates/agents/
- Verified with scripts/check-template-sync.sh - all templates in sync
Addresses: #38 (comment)
Summary
Enhanced all 8 MAP Framework agents to leverage 18 available Cipher MCP tools for reasoning memory, knowledge graph operations, intelligent processing, and cross-project learning.
Changes by Agent
🧩 task-decomposer.md
cipher_search_reasoning_patternsas tool Handle missing recitation subtask IDs #2🎭 actor.md
🔍 monitor.md
cipher_search_graph- understand code dependenciescipher_get_neighbors- trace dependency chainscipher_add_node/add_edge- record validation results📊 predictor.md
cipher_intelligent_processorfor NL impact statements⚖️ evaluator.md
cipher_search_reasoning_patterns🔬 reflector.md
cipher_search_reasoning_patterns- find similar reasoning tracescipher_store_reasoning_memory- store complete traces with contextcipher_extract_reasoning_steps- structure complex analysiscipher_evaluate_reasoning- quality gate before storage📚 curator.md
cipher_intelligent_processorfor entity extractioncipher_extract_and_operate_memoryusage:enableDeleteOperations: falseto prevent accidental deletionsTemplate Synchronization ✅
All changes synchronized to
src/mapify_cli/templates/agents/:Verified with
scripts/check-template-sync.sh- all templates in sync!Key Benefits
Dual Memory System
The dual memory system is now fully operational:
.claude/playbook.db) - project-specific structured patternsValidation
✅ Pre-commit hooks passed:
✅ Integration counts verified:
Test Plan
/map-featurewith test task, verify agents invoke new MCP toolsFiles Changed
14 files, 1002 insertions(+), 24 deletions(-)
.claude/agents/src/mapify_cli/templates/agents/Impact
Breaking Changes: None
Backward Compatible: Yes (all enhancements are additive)
Documentation: Agent files are self-documenting with comprehensive examples
When running MAP workflows (
/map-feature,/map-debug,/map-refactor), agents will now:✅ Search cipher for similar patterns before starting work
✅ Learn from reasoning traces of successful past executions
✅ Track dependencies through knowledge graph
✅ Share high-quality patterns across projects
The dual memory system (Playbook + Cipher) is now fully operational across all 8 agents! 🚀