Helper Archetypes
1. The Cortex Model
The Cortex is a complete ensemble of helper agents supporting a main reasoning agent. Each archetype operates at a specific phase—before, during, or after the main agent's cognition—providing anticipatory context, warnings, speculative branches, validation, observation capture, and context management.
┌─────────────────────────────────────────────────────────────────────┐
│ THE CORTEX │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ BEFORE MAIN DURING MAIN AFTER MAIN │
│ ─────────── ─────────── ────────── │
│ │
│ ┌─────────┐ ┌───────────┐ ┌─────────┐ │
│ │ SCOUTS │──context──►│ │ ◄──obs── │ SCRIBES │ │
│ │ ○○○ │ │ MAIN │ │ ○○ │ │
│ └─────────┘ │ AGENT │ └─────────┘ │
│ │ ◉◉◉ │ │
│ ┌─────────┐ │ │ ┌───────────┐ │
│ │LOOKOUTS │──warnings──►│ │ ◄──chk── │VALIDATORS │ │
│ │ ○○ │ │ │ │ ○○○ │ │
│ └─────────┘ └───────────┘ └───────────┘ │
│ │ │
│ ┌────────────┐ │ CONTINUOUS │
│ │SPECULATORS │──branches──► │ ────────── │
│ │ ○○○ │ │ ┌─────────────┐ │
│ └────────────┘ └─────────►│ LIBRARIANS │ │
│ │ ○○ │ │
│ └─────────────┘ │
└───────────────────────────────────────────────────────────────────┘
Every helper uses cheap cognition (○)—fast, lightweight models like Claude Haiku—to augment the main agent's expensive cognition (◉). This keeps costs low while dramatically improving decision quality, constraint adherence, and learning velocity.
2. PatternAtom Definitions
🔭 Scout — Anticipatory Context Gathering
Phase: Before main · Tier: Cheap · Instances: Up to 3 parallel
Scouts anticipate what context the main agent will need and pre-fetch it from the AKG, reducing main agent token consumption and improving decision quality. They query prior decisions, active constraints, and relevant code via vector search.
○◁AKG ──▷── Main ◉
| Pre-Query | Source | Cache TTL |
|---|---|---|
| Prior decisions | DecisionAtom ORDER BY created_at DESC LIMIT 5 | 300s |
| Active constraints | ConstraintAtom WHERE active = true | 600s |
| Relevant code | Vector search on code_embedding_idx (score > 0.7) | — |
Results are injected as structured context into the main agent's prompt, formatted with prior decisions, constraint descriptions, and code relevance scores.
👁 Lookout — Blocking Issue Detection
Phase: Before main · Tier: Cheap · Instances: Up to 2 parallel
Lookouts scan for potential blockers, conflicts, or risks that could invalidate the main agent's approach. They detect concurrent file modifications, policy violations against planned tools, and unhealthy external resources.
○◁ENV ──⚠──▷ Main
Lookouts only activate for tasks with task_complexity >= 'medium'. When blockers are detected, they send high-priority warning messages to the main agent before expensive computation is wasted.
🔮 Speculator — Branch Prediction
Phase: During main · Tier: Cheap · Instances: Up to 4 parallel (one per branch)
Speculators predict likely decision points and pre-compute partial results for each branch. When the main agent decides, the relevant pre-computation is immediately available, eliminating redundant reasoning.
Main ◉ "considering A or B"
│
├──○ speculate A
└──○ speculate B
↓
Main ◉ decides → inject matching branch
For each branch, speculators pre-compute required file changes, potential conflicts, and estimated complexity. The losing branch is discarded. Historical decisions are queried to inform branch likelihood.
✓ Validator — Continuous Constraint Checking
Phase: During main · Tier: Cheap · Instances: Up to 3 parallel
Validators continuously check main agent outputs against active constraints, providing immediate feedback rather than waiting for post-execution review. They combine LLM-based evaluation with pattern matching.
Main ◉──output──▷
│
└──○ validate ◁constraints
│
└──feedback──▷ Main
| Check Type | Method | Targets |
|---|---|---|
| Architecture | LLM evaluation | Active ConstraintAtom (code, architecture, security types) |
| Hardcoded secrets | Regex pattern | (password|secret|api_key)\s*=\s*['"][^'"]+['"] |
| SQL injection | Regex pattern | execute\s*\([^)]*\+|format\s*\([^)]*% |
Failed checks create ConstraintViolationAtom records and send high-priority feedback to the main agent with specific remediation guidance.
📝 Scribe — Learning Capture
Phase: During main · Tier: Cheap · Instances: Up to 2 parallel
Scribes observe the main agent's reasoning process and capture learnings that feed the flywheel. They watch thinking patterns, tool effectiveness, and constraint interactions, creating ObservationAtom records when confidence reaches 0.7 or higher.
Main ◉──thinking──┐
│ │
└──output────┤
▼
Scribe ○──▷ ObservationAtom
Observations are aggregated within a session window with similarity deduplication (threshold: 0.85). High-confidence observations (≥ 0.9) automatically fire the promote-observation-to-constraint trigger.
📚 Librarian — Context Window Management
Phase: Continuous · Tier: Cheap
Librarians monitor context window usage and proactively manage what stays in context versus what gets compressed or externalized. They activate when context usage reaches 60% and escalate through three tiers.
Context [████████░░] 80%
│
└── Librarian ○ ──compress/externalize──▷
│
Context [████░░░░░░] 40%
| Threshold | Action | Strategy |
|---|---|---|
| ≥ 70% | Summarize history | Preserve key decisions, current task, recent tool outputs |
| ≥ 85% | Externalize outputs | Move large tool outputs to AKG as ArtifactAtom, replace with reference |
| ≥ 95% | Emergency compression | Aggressive compress, preserve only system prompt + current task + last turn |
3. Complete TURN Scores
Full Cortex Ensemble
The complete cognitive support ensemble for complex reasoning tasks. All six archetypes working together across 7 tracks:
𝄞 [DecisionAtom, ConstraintAtom, CodeAtom, ObservationAtom]
♯layered_architecture ♯no_secrets
20/100K💭
Scouts: ║ ○◁AKG │ · │ ○◁AKG │ · │...│ · ║
Lookouts: ║ ○◁ENV │ · │ · │ · │...│ · ║
Speculators: ║ · │ ○○○○ │ · │ ○○○○ │...│ · ║
Main Agent: ║ · ◉💭 │ ◉ │ · ◉💭 │ ◉ │...│ ◉▷■ ║
Validators: ║ · │ · ○○○ │ · │ · ○○○ │...│ · ║
Scribes: ║ · │ · ○ │ · │ · ○ │...│ ○▷ ║
Librarians: ║ · │ · · ○ │ · │ · · ○ │...│ · ║
Initialization: scouts and lookouts gather context and detect blockers. The main agent waits at a sync point, then begins expensive reasoning with full context. Speculators pre-compute branches during main agent thinking. Validators check every output. Scribes capture learnings. Librarians manage context when usage exceeds 70%. Repeats until TASK_COMPLETE.
Lightweight Scout + Validator
A minimal ensemble for medium-complexity tasks where the full cortex is overkill:
𝄞 [CodeAtom, ConstraintAtom]
♯code_quality (advisory)
10/30K
Scouts: ║ ○ │ · │ · │ · │...║
Main Agent: ║ · │ ◉ │ ◉ │ ◉ │...║
Validators: ║ · │ · │ ○ │ ○ │...║
Reasoning Loop with Flywheel
Reasoning-guided iteration with full flywheel integration. Thinking guides context injection, observations promote to constraints, and the router learns from execution:
𝄞 [ExecutionAtom, ObservationAtom, ConstraintAtom, RouterAtom]
∞/200K💭
|:
Scouts: │ ○◁thinking ▷context │
Main: │ · ◉💭 │
Scribes: │ · ○▷Obs │
│ ↓ │
│ @trigger │
│ (if confident) │
│ ↓ │
│ ConstraintAtom │
:|
⟳ Execute → Observe → Constrain → Route
Thinking-guided scouts use the main agent's reasoning to discover relevant skills via vector search. Scribes capture observations that, at confidence ≥ 0.9, fire the promotion trigger. The flywheel creates a continuous learning loop across sessions.
4. CLI Commands
# Pattern management
adamas-patterns create pattern-scout-enrichment.turn
adamas-patterns list
adamas-patterns list --archetype scout
adamas-patterns show <pattern_id>
adamas-patterns search "pre-fetch context before reasoning"
# Score management
adamas-scores create score-cortex-ensemble.turn
adamas-scores list
adamas-scores list --pattern-type parallel_fanout
adamas-scores show <score_id>
adamas-scores search "parallel validation for code review"
adamas-scores validate score.turn
# Execute a score
adamas-scores execute score_cortex_ensemble_v1 \
--inputs '{"repo_id": "repo_xyz", "task": "Implement authentication"}' \
--async
Semantic search uses vector embeddings to discover patterns by intent, not just keywords. For example, searching "pre-fetch context before reasoning" returns the scout enrichment pattern with a relevance score of 0.94.
5. Wiring to Existing Agents
Existing agents reference helper patterns through configuration. Each agent specifies which archetypes to use, a default score for typical tasks, and complexity-based overrides:
{
"id": "agent_security_auditor",
"name": "Security Auditor",
"helper_patterns": {
"scouts": ["scout-enrichment"],
"validators": ["continuous-validation"],
"scribes": ["scribe-observation"]
},
"default_score": "score-scout-validator-minimal",
"score_overrides": {
"high_complexity": "score-cortex-ensemble",
"quick_check": null
}
}
At runtime, the orchestrator determines task complexity and selects the appropriate TURN score. Direct execution (no helpers) is used for simple tasks where score overhead is unwarranted. The determine_score function checks explicit overrides first, then complexity-based overrides, then falls back to the agent's default score.
