Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

azalio/map-framework

Repository files navigation

MAP Framework for Claude Code

Implementation of Modular Agentic Planner (MAP) β€” a cognitive architecture for AI agents inspired by prefrontal cortex functions. Orchestrates 10 specialized agents for development with automatic quality validation.

Based on: Nature Communications research (2025) β€” 74% improvement in planning tasks Enhanced with: ACE (Agentic Context Engineering) β€” continuous learning from experience

πŸ“– Documentation Structure

  • README (this file) - Quick start and overview
  • INSTALL.md - Complete installation guide with PATH setup and troubleshooting
  • ARCHITECTURE.md - Technical deep dive, customization, and MCP integration
  • USAGE.md - Practical examples, best practices, cost optimization, and dependency validation

πŸš€ Quick Start

Inside Claude Code (Recommended)

# ⭐ RECOMMENDED: Efficient workflow (40-50% token savings)
/map-efficient implement user profile page with avatar upload
# Debugging
/map-debug fix the API 500 error on login endpoint
# ⚠️ Fast workflow (40-50% savings, NO learning - throwaway code only)
/map-fast prototype a quick API endpoint mockup
# πŸ“š Optional: Preserve learnings from any workflow
/map-learn [paste workflow summary to extract patterns]
# πŸ“¦ Release workflow (for package maintainers)
/map-release patch # or: minor, major

Command Line Usage

MAP Framework works exclusively through slash commands in Claude Code:

# Start Claude Code in your project directory
cd your-project
claude
# Use slash commands inside Claude Code
/map-efficient implement user authentication with JWT tokens

Note: Direct claude --agents syntax is not applicable to MAP Framework, as the orchestration logic is implemented in slash command prompts (.claude/commands/map-*.md), not as a separate agent file.

πŸ“¦ Installation

Stable Release (Recommended)

# Using pip
pip install mapify-cli
# OR using UV (recommended for isolated tools)
uv tool install mapify-cli
# Verify installation
mapify --version
# Initialize in your project
cd your-project
mapify init
# Available commands
mapify --help # Show all available commands
mapify validate graph <file> # Validate task dependency graphs
mapify playbook search <query> # Search playbook patterns

Version Pinning:

# Install specific version
pip install mapify-cli==1.0.0
# Install with version constraints (semantic versioning: MAJOR.MINOR.PATCH)
pip install "mapify-cli>=1.0.0,<2.0.0" # Allow 1.x versions, exclude 2.0.0+

Version Information:

  • Check installed version: mapify --version
  • PyPI releases - Available versions and package details
  • GitHub releases - Changelog and release notes

Development Installation

For contributors or testing bleeding-edge features:

# Install from git repository
uv tool install --from git+https://github.com/azalio/map-framework.git mapify-cli
# OR clone and install locally
git clone https://github.com/azalio/map-framework.git
cd map-framework
pip install -e .

Other installation methods (manual copy, troubleshooting): See INSTALL.md

For maintainers: Release process documented in RELEASING.md

πŸ”€ Workflow Variants

MAP Framework offers workflow variants optimized for different scenarios:

Command Token Usage Learning Quality Gates Best For
/map-efficient ⭐ 50-60% Optional via /map-learn βœ… Essential agents RECOMMENDED: Most production tasks
/map-debug 50-60% Optional via /map-learn βœ… Essential agents Bug fixes and debugging
/map-fast ⚠️ 40-50% ❌ None ⚠️ Basic only Throwaway prototypes, experiments (NOT production)
/map-learn ~5-8K tokens βœ… Full Reflector + Curator Capture patterns after any workflow
/map-release Variable Optional via /map-learn 12 validation gates Package releases

Which Workflow Should You Use?

Use /map-efficient (RECOMMENDED) when:

  • βœ… Building production features where token costs matter
  • βœ… Well-understood tasks with low to medium risk
  • βœ… Iterative development with frequent workflows
  • βœ… Run /map-learn afterward if you want to preserve patterns

Use /map-debug when:

  • πŸ”§ Fixing bugs or investigating errors
  • πŸ”§ Root cause analysis needed
  • πŸ”§ Systematic debugging approach required

Use /map-fast (minimal) ONLY when:

  • πŸ—‘οΈ Creating throwaway prototypes you'll discard
  • πŸ—‘οΈ Quick experiments where quality doesn't matter
  • πŸ—‘οΈ Learning/tutorial contexts where failure is acceptable
  • ⚠️ NEVER for production code - no learning, quality risks

Use /map-learn after any workflow:

  • πŸ“š To preserve valuable patterns discovered during work
  • πŸ“š When implementation approach could help future tasks
  • πŸ“š To update playbook and cross-project cipher knowledge

🎯 Auto-Activation System

Don't remember which workflow to use? MAP automatically suggests the right workflow based on your request!

Just describe your task naturally - no need to remember slash commands:

Your Request MAP Suggests Why
"Fix the failing tests" /map-debug Keywords: fix, failing test
"Implement user login" /map-efficient Keywords: implement, feature
"Optimize database queries" /map-efficient Keywords: optimize
"Quick prototype for testing" /map-fast Keywords: quick, prototype
"Save patterns from last task" /map-learn Keywords: save, patterns, learn

How it works:

  1. Start typing your request normally
  2. MAP analyzes keywords and intent patterns
  3. Suggests the most appropriate workflow
  4. You can accept the suggestion or proceed with your request

Customization: Edit .claude/workflow-rules.json to add project-specific trigger words and patterns.

Key Differences

/map-efficient optimizations:

  • Conditional Predictor: Only called for high-risk tasks (security, breaking changes)
  • Evaluator Skipped: Monitor provides sufficient validation for most tasks
  • Learning Optional: Run /map-learn separately to capture patterns
  • Result: 40-50% token savings with essential quality gates

/map-fast limitations:

  • ❌ No impact analysis (Predictor skipped)
  • ❌ No quality scoring (Evaluator skipped)
  • ❌ No learning (Reflector/Curator skipped)
  • πŸ’‘ Can add learning retroactively via /map-learn

/map-learn benefits:

  • βœ… Calls Reflector to extract patterns from workflow
  • βœ… Calls Curator to update playbook
  • βœ… Syncs high-quality bullets to cipher (cross-project knowledge)
  • βœ… Run after any workflow when patterns are worth preserving

See USAGE.md for detailed decision guide and real-world token usage examples.

πŸ“š Skills System

MAP includes interactive skills that provide specialized guidance:

map-workflows-guide - Helps you choose the right workflow

Auto-suggested when you ask:

  • "Which workflow should I use?"
  • "What's the difference between workflows?"
  • "When to use /map-efficient vs /map-fast?"

What you get:

  • Quick decision tree (5 questions β†’ recommended workflow)
  • Comparison matrix (token cost, learning, agents, use cases)
  • 8 detailed resource guides (progressive disclosure)

Skills vs Agents:

  • Skills = Passive documentation (guidance)
  • Agents = Active execution (code generation)

See docs/USAGE.md for full details.

Requirements

  • Claude Code CLI β€” installed and configured
  • Python 3.11+ β€” for mapify CLI (optional)
  • Git β€” for cloning repository

πŸ—οΈ Architecture

MAP Framework orchestrates 10 specialized agents through slash commands:

  • TaskDecomposer breaks goals into subtasks
  • Actor generates code, Monitor validates quality
  • Predictor analyzes impact, Evaluator scores solutions
  • Reflector/Curator enable continuous learning via ACE playbook

The orchestration logic lives in .claude/commands/map-*.md prompts, coordinating agents via the Task tool.

See ARCHITECTURE.md for:

  • Detailed agent specifications and responsibilities
  • MCP integration architecture and tool usage patterns
  • Agent coordination protocol and workflow stages
  • Template customization guide with examples
  • Hooks integration (automated validation, knowledge storage, context enrichment)
  • Context engineering principles and optimizations

πŸ”Œ MCP Integration

MAP uses MCP (Model Context Protocol) servers for enhanced capabilities:

  • cipher - Knowledge base for storing and retrieving successful patterns
  • claude-reviewer - Professional code review with security analysis
  • context7 - Up-to-date library documentation
  • sequential-thinking - Chain-of-thought reasoning for complex problems
  • deepwiki - GitHub repository intelligence

During mapify init, two configuration files are created:

  • .mcp.json - Project-level Claude Code MCP server registration (standard format)
  • .claude/mcp_config.json - Internal MAP Framework agent-to-MCP mappings

If .mcp.json already exists, mapify init will merge new servers without overwriting your existing configuration.

See ARCHITECTURE.md for complete setup and usage patterns

πŸ“š Usage Examples

# Feature development (recommended)
/map-efficient implement user profile page with avatar upload
# Bug fixing
/map-debug debug why payment processing fails for amounts over 1ドル000
# After completing work, optionally preserve learnings
/map-learn Implemented user profile with avatar. Files: profile.py, upload.py.
 Used pre-signed S3 URLs. Iterations: 2.

See USAGE.md for:

  • Comprehensive usage examples with detailed scenarios
  • Best practices for optimal results
  • Cost optimization strategies (40-60% savings)
  • Playbook management commands

πŸŽ“ ACE Playbook

Built-in learning system that improves when you run /map-learn:

  • Reflector extracts patterns from successes and failures
  • Curator maintains structured knowledge base with quality tracking
  • Semantic search (optional) finds patterns by meaning, not keywords
  • Dependency validation ensures valid task graphs before execution
  • High-quality patterns sync to cipher for cross-project reuse

Note: Learning is optional and triggered via /map-learn command after workflows.

Playbook Commands

# View statistics
mapify playbook stats
# Search patterns
mapify playbook search "JWT authentication"
# View high-quality patterns
mapify playbook sync
# Validate task dependencies with visualization
python scripts/validate-dependencies.py decomposer-output.json --visualize

Optional semantic search: pip install -r requirements-semantic.txt for meaning-based matching. Details in SEMANTIC_SEARCH_SETUP.md and ARCHITECTURE.md.

Playbook configuration: See ARCHITECTURE.md for top_k settings and optimization.

Dependency validation: See USAGE.md for comprehensive guide on validating TaskDecomposer output, including cycle detection, visualization, and CI/CD integration.

πŸ’° Cost Optimization

MAP Framework uses intelligent model selection per agent:

  • Predictor & Evaluator use haiku (fast analysis) β†’ ⬇️⬇️⬇️ cost
  • Actor, Monitor, Reflector, Curator use sonnet (quality-critical) β†’ balanced cost

Result: 40-60% cost reduction vs all-sonnet while maintaining code quality.

See USAGE.md for detailed cost breakdown and model override strategies

πŸ”— Hooks Integration

MAP integrates with Claude Code hooks for automated validation, knowledge storage, and context enrichment. Active hooks protect template variables, auto-store successful patterns, enrich prompts with relevant knowledge, and track performance metrics.

See ARCHITECTURE.md and .claude/hooks/README.md for configuration

πŸ› οΈ Troubleshooting

Command Not Found

Error: Slash command not recognized

Solution:

  • Ensure you're in a directory with .claude/commands/ containing map-*.md files
  • Available commands: /map-efficient, /map-debug, /map-fast, /map-learn, /map-release
  • Run /help to see available commands

Agent Not Found

Error: Agent file not found

Solution: Ensure .claude/agents/ directory contains all 8 agent files (task-decomposer.md, actor.md, monitor.md, predictor.md, evaluator.md, reflector.md, curator.md, documentation-reviewer.md)

Semantic Search Warning

Warning: sentence-transformers not installed

Solution: pip install -r requirements-semantic.txt See SEMANTIC_SEARCH_SETUP.md for detailed troubleshooting

Infinite Loops

Actor-Monitor loop exceeding iterations

Solution: Orchestrator limits iterations to 3-5. Clarify requirements or add constraints.

More troubleshooting: See INSTALL.md for PATH issues, MCP configuration, and installation problems

πŸ”§ Customization

Agent prompts in .claude/agents/*.md use Handlebars template syntax for dynamic context injection. You can safely modify instructions, examples, and validation criteria, but MUST NOT remove template variables like {{language}}, {{#if playbook_bullets}}, or {{feedback}} β€” these are critical for orchestration and ACE learning.

See ARCHITECTURE.md for:

  • Safe vs unsafe modifications with examples
  • Template variable reference
  • Model selection per agent
  • Adding custom agents
  • Template validation and git hooks

πŸ“Š Success Metrics

  • Monitor approval rate: >80% first try
  • Evaluator scores: average >7.0/10
  • Iteration count: <3 per subtask
  • Playbook growth: increasing high-quality patterns

🀝 Contributing

Improvements welcome:

  • Prompts for specific languages/frameworks
  • New specialized agents
  • CI/CD integrations
  • Success story examples
  • Plugin extensions for MAP Framework

πŸ“„ License

MIT License β€” see LICENSE file for details

πŸ”— References


MAP is not just automation β€” it's systematic quality improvement through structured validation and iterative refinement.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /