Master protocol for deconstructing agent frameworks to inform derivative system architecture...
Deconstruct agent frameworks to inform derivative system architecture.
Distinguish between software engineering decisions (how it runs) and cognitive architecture decisions (how it thinks) to extract reusable patterns for new systems.
# 1. Map the codebase (uses codebase-mapping skill's script)
python .claude/skills/codebase-mapping/scripts/map_codebase.py /path/to/framework --output codebase-map.json
# 2. Run analysis via the command
/analyze-frameworks
Analyze the software substrate. See references/phase1-engineering.md for detailed guidance.
| Analysis | Focus Files | Output |
|---|---|---|
| Data Substrate | types.py, schema.py, state.py | Typing strategy, mutation patterns |
| Execution Engine | runner.py, executor.py, agent.py | Async model, control flow topology |
| Component Model | base_*.py, interfaces.py | Abstraction depth, DI patterns |
| Resilience | executor.py, try/except blocks | Error propagation, sandboxing |
Extract agent "business logic". See references/phase2-cognitive.md for detailed guidance.
| Analysis | Focus Files | Output |
|---|---|---|
| Control Loop | agent.py, loop.py | Reasoning pattern, step function |
| Memory | memory.py, context.py | Context assembly, eviction policies |
| Tool Interface | tool.py, functions.py | Schema generation, error feedback |
| Harness-Model Protocol | llm.py, adapters/, stream.py | Wire format, tool call encoding, agentic primitives |
| Multi-Agent | orchestrator.py, router.py | Coordination model, state sharing |
Generate actionable outputs:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā For Each Framework ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā 1. codebase-mapping ā
ā ā ā
ā 2. Phase 1 Analysis (parallel) ā
ā āāā data-substrate-analysis ā
ā āāā execution-engine-analysis ā
ā āāā component-model-analysis ā
ā āāā resilience-analysis ā
ā ā ā
ā 3. Phase 2 Analysis (parallel) ā
ā āāā control-loop-extraction ā
ā āāā memory-orchestration ā
ā āāā tool-interface-analysis ā
ā āāā harness-model-protocol ā
ā āāā multi-agent-analysis (if applicable) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Synthesis ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā 4. comparative-matrix ā
ā 5. antipattern-catalog ā
ā 6. architecture-synthesis ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
For rapid assessment, run the minimal path:
codebase-mapping ā execution-engine-analysis ā control-loop-extraction ā tool-interface-analysis
forensics-output/ # Working/intermediate files
āāā .state/
ā āāā manifest.json
ā āāā {framework}.state.json
āāā frameworks/
āāā {framework}/
āāā codebase-map.json
āāā phase1/*.md
āāā phase2/*.md
reports/ # Final deliverables
āāā frameworks/
ā āāā {framework}.md # Framework summary
āāā synthesis/
āāā comparison-matrix.md
āāā antipatterns.md
āāā reference-architecture.md
āāā executive-summary.md
The protocol is designed to be stateful and resumable.
manifest.json and will skip frameworks marked as completed.in_progress are considered "stale". Use python scripts/state_manager.py reset-running to move them back to pending and delete their partial output directories, ensuring a clean restart for those items.This skill uses a 4-tier hierarchy of specialized agents for context efficiency:
Orchestrator
ā
āāā Framework Agents (parallel, one per framework)
ā
āāā Skill Agents (parallel, one per skill) [COORDINATORS]
ā
āāā Reader Agents (parallel, one per file cluster) [EXTRACTORS]
ā
āāā Synthesis Agent (cross-framework synthesis)
| Agent | Context Budget | Reads | Produces |
|---|---|---|---|
| Orchestrator | ~10K | State files | Coordination decisions |
| Framework Agent | ~50K | Skill outputs | Framework summary report |
| Skill Agent | ~25K | Cluster extracts | Skill analysis report |
| Reader Agent | ~20K | 1-5 source files | JSON extract (~2K) |
| Synthesis Agent | ~40K | All framework reports | Comparison matrix, architecture spec |
Reader Agents read file clusters (1-5 related files) rather than individual files:
See:
references/orchestrator-agent.md ā Top-level coordinationreferences/framework-agent.md ā Per-framework analysis coordinationreferences/skill-agent.md ā Skill coordination and cluster assignmentreferences/reader-agent.md ā File cluster extractionreferences/synthesis-agent.md ā Cross-framework synthesis| Skill | Purpose | Key Outputs |
|---|---|---|
codebase-mapping |
Repository structure | File tree, dependencies, entry points |
data-substrate-analysis |
Type system | Typing strategy, serialization |
execution-engine-analysis |
Control flow | Async model, event architecture |
component-model-analysis |
Extensibility | Abstraction patterns, DI |
resilience-analysis |
Error handling | Error propagation, sandboxing |
control-loop-extraction |
Reasoning loop | Pattern classification, step function |
memory-orchestration |
Context management | Assembly, eviction, tiers |
tool-interface-analysis |
Tool system | Schema gen, error feedback |
harness-model-protocol |
LLM interface layer | Wire format, encoding, agentic primitives |
multi-agent-analysis |
Coordination | Handoffs, state sharing |
comparative-matrix |
Comparison | Decision tables |
antipattern-catalog |
Tech debt | Do-not-repeat list |
architecture-synthesis |
New design | Reference spec |