School-Core Comprehensive Audit & Task Plan
Generated: 2026-07-22
Method: Full codebase audit (25+ modules), dependency graph analysis, blast-radius mapping
Architecture Snapshot (Current State)
conductor.py ───── Principal CLI
└── director.py ─── routing + system prompts + review orchestration
├── executor.py ─── OmniRoute/A2A transport layer
├── scoring.py ─── EMA score store + gate thresholds
├── bookbag.py ─── student output persistence
├── adversarial_reviewer.py ─── CTO+COO engine
│ └── lenses/*.py ─── correctness, security, completeness prompts
├── context_orchestrator.py ─── vault/engram/skills/bookbag injection
│ ├── engram_adapter.py ─── persistent memory
│ └── 03-Skills/ (KnowledgeCore) ─── CE workflows
├── anchor_loader.py ─── semantic anchors from config/anchors.yaml
├── trajectory.py ─── persistent trajectory logging
└── sleep_state.py ─── session sleep/wake
Dependency Map
Layer 1: Foundation (zero internal dependencies)
Module Dependencies Notes bookbag.pystdlib only Stable, proven engram_adapter.pyengram CLI binaryThin wrapper decision_log.pystdlib only Stable activity_log.pystdlib only Stable escalation_log.pystdlib only Stable lenses/*.pyLensType enumPure string constants anchor_loader.pyyaml lib + dataclassesStable verify_gate.pystdlib only Exists but UNWIRED triage_classifier.pystdlib only Wired but unused in main pipeline
Layer 2: Utilities (depend on Layer 1)
Module Dependencies scoring.pyexecution_scorer, heuristic_scorertrajectory.pyengram_adaptercontext_orchestrator.pyengram_adapter, bookbagconsolidation_writer.pyengram_adaptersleep_state.pyengram_adapter
Layer 3: Core Logic (depend on Layer 2)
Module Dependencies executor.pyOmniRoute HTTP, A2A HTTP (stdlib + urllib) adversarial_reviewer.pylenses/*.pydirector.pyexecutor, scoring, context_orchestrator, anchor_loader, adversarial_reviewer, trajectory, bookbag, decision_log, triage_classifierrouting.pyscoring
Layer 4: Entry Points (depend on Layer 3)
Module Dependencies conductor.pydirector, scoring, bookbagmcp_server.pydirector, routing, scoring, executor, context_orchestrator, trajectoryautonomous_loop.pydirector, scoringcli.pyscoringissue_bridge.pyscoring, triage_classifierstaff/plugins/*.pyscoring
Identified Tasks (Ordered by Workstream)
Workstream A: MCP Server Modernization
Blast radius: mcp_server.py only (no other files change)
Risk: Low — self-contained file, no callers depend on internals
Effort: Small (~50 lines changed)
# Task Files Depends On A1 Switch MCP server from SYSTEM_PROMPTS to ROLE_SYSTEM_PROMPTS mcp_server.pyNothing A2 Add role parameter to enrich_prompt call in school_execute mcp_server.pyA1 A3 Inject semantic anchors via _anchor_context() in MCP handlers mcp_server.pyA1 A4 Remove dead "Foundry" backend reference from _backend_for_agent mcp_server.pyNothing
Workstream B: Verify Gate → Review Pipeline
Blast radius: ~2 files (director.py + potentially verify_gate.py)
Risk: Low — additive change, existing review flow unchanged
Effort: Small (~30 lines added)
# Task Files Depends On B1 Call verify_gate.run_verify_gate() inside _run_two_judge_review() when domain has executable output director.py, verify_gate.pyNothing B2 Feed execution failures as CRITICAL findings into CTO review director.pyB1
Workstream C: Dead Code Cleanup
Blast radius: Low — nothing depends on these
Effort: Small
# Task Files Depends On C1 Fix test_anchor_loader.py — remove from prompt_composer import compose_prompt tests/test_anchor_loader.pyNothing C2 Fix test_role_loader.py — remove from prompt_composer import ROLE_ANCHORS tests/test_role_loader.pyNothing C3 Delete prompt_composer.py prompt_composer.pyC1, C2 C4 Delete dead prompt_composer.py reference in anchor_loader.py docstring anchor_loader.pyNothing
Workstream D: Browser Role Anchors
Blast radius: config/anchors.yaml + director.py
Risk: Low — additive only
Effort: Small (~5 anchors)
# Task Files Depends On D1 Add web-automation domain anchors to config/anchors.yaml (e.g., Page Object Model, Selector Strategy, Wait Strategy) config/anchors.yamlNothing D2 Add web-automation domain to browser's ROLE_ANCHOR_DOMAINS director.pyD1
Workstream E: Auth Token Security
Blast radius: executor.py
Risk: Low — env var fallback only
Effort: Tiny (~3 lines)
# Task Files Depends On E1 Read API_KEY from env var with fallback to hardcoded value executor.pyNothing
Workstream F: Documentation Sync
Blast radius: campus.md
Risk: Trivial
Effort: Small
# Task Files Depends On F1 Update campus.md to reflect current Principal→CTO+COO architecture (the aspirational table was last updated — verify it matches) campus.mdNothing F2 Document the 5 specialized roles, bookbag schema, and Orca dispatch flow campus.mdF1
Parallelization Matrix
A1 A2 A3 A4 B1 B2 C1 C2 C3 C4 D1 D2 E1 F1 F2
A1 (mcp role) ─ ▶ ▶ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆
A2 (mcp role) ─ ─ ▶ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆
A3 (mcp role) ─ ─ ─ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆
A4 (foundry) ─ ─ ─ ─ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆
B1 (verify) ◆ ◆ ◆ ◆ ─ ▶ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆
B2 (verify) ◆ ◆ ◆ ◆ ─ ─ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆
C1 (test fix) ◆ ◆ ◆ ◆ ◆ ◆ ─ ◆ ▶ ◆ ◆ ◆ ◆ ◆ ◆
C2 (test fix) ◆ ◆ ◆ ◆ ◆ ◆ ◆ ─ ▶ ◆ ◆ ◆ ◆ ◆ ◆
C3 (delete) ◆ ◆ ◆ ◆ ◆ ◆ ▶ ▶ ─ ◆ ◆ ◆ ◆ ◆ ◆
C4 (doc fix) ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ─ ◆ ◆ ◆ ◆ ◆
D1 (anchors) ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ─ ▶ ◆ ◆ ◆
D2 (anchors) ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ─ ─ ◆ ◆ ◆
E1 (auth) ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ─ ◆ ◆
F1 (docs) ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ─ ▶
F2 (docs) ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ─ ─
▶ = must be sequential (depends on)
◆ = safe to parallelize (no shared code)
Optimal Execution Order
Phase 1 — Parallel (safe to run all at once):
Batch Tasks Files changed Batch 1 A1, A4 (MCP role switch + Foundry removal) mcp_server.pyBatch 2 B1 (Verify gate wiring) director.pyBatch 3 C1, C2, C4 (Test fixes + docstring fix) tests/test_anchor_loader.py, tests/test_role_loader.py, anchor_loader.pyBatch 4 D1 (Anchors YAML) config/anchors.yamlBatch 5 E1 (Auth token env var) executor.pyBatch 6 F1 (Campus docs) campus.md
Phase 2 — Sequential (depends on Phase 1):
Batch Tasks Depends on Batch 7 A2, A3 (MCP role param + anchors) Batch 1 (A1) Batch 8 B2 (Execution failures as findings) Batch 2 (B1) Batch 9 C3 (Delete prompt_composer.py) Batch 3 (C1, C2) Batch 10 D2 (Browser domain mapping) Batch 4 (D1) Batch 11 F2 (Detailed docs) Batch 6 (F1)
What NOT To Do (Out of Scope)
Thing Why Wire Serena/CodeGraph MCP into executor.py Massive architectural change — needs MCP client integration, not a quick wiring Rebuild student execution pipeline The current text-completion-only model is a design choice; changing it is a v2 problem Add web-automation anchors for browser D1 covers this, but the actual anchors content needs you to decide which methodologies fit Add new roles or domains Would require new seeds, new prompts, new COMBO_MAP entries — beyond audit scope Refactor scoring.py EMA weights Would change existing agent behavior — needs validation against real data
Recommendation: Optimal Order
If you want maximum parallel speed (6 agents in parallel):
Wave 1 (parallel): A1+A4 │ B1 │ C1+C2+C4 │ D1 │ E1 │ F1
Wave 2 (parallel): A2+A3 │ B2 │ C3 │ D2 │ F2
If you want to do it yourself, start with:
1. E1 (auth token) — 3 lines, 30 seconds
2. C1, C2, C4 (dead imports) — 2 minutes
3. A1, A4 (MCP server) — 10 minutes, biggest impact
4. D1 (anchors) — 10 minutes
5. B1 (verify gate) — 15 minutes
6. Run all tests → C3 (delete prompt_composer) + D2 + F1+F2
Blast Radius by File
File How many imports it Who imports it Can it change alone? mcp_server.py0 (no one imports it) — ✅ Yes, fully isolated executor.py6 files director, mcp_server, routing ⚠️ Needs test pass after director.py4 files conductor, mcp_server, autonomous_loop, issue_bridge ⚠️ Needs test pass after prompt_composer.py2 test files test_anchor_loader, test_role_loader ✅ Can delete cleanly config/anchors.yaml1 file anchor_loader (runtime) ✅ Yes, additive only verify_gate.py0 (unused) — ✅ Yes, fully isolated campus.md0 — ✅ Yes, docs only anchor_loader.py1 file director ⚠️ Needs test pass