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)

ModuleDependenciesNotes
bookbag.pystdlib onlyStable, proven
engram_adapter.pyengram CLI binaryThin wrapper
decision_log.pystdlib onlyStable
activity_log.pystdlib onlyStable
escalation_log.pystdlib onlyStable
lenses/*.pyLensType enumPure string constants
anchor_loader.pyyaml lib + dataclassesStable
verify_gate.pystdlib onlyExists but UNWIRED
triage_classifier.pystdlib onlyWired but unused in main pipeline

Layer 2: Utilities (depend on Layer 1)

ModuleDependencies
scoring.pyexecution_scorer, heuristic_scorer
trajectory.pyengram_adapter
context_orchestrator.pyengram_adapter, bookbag
consolidation_writer.pyengram_adapter
sleep_state.pyengram_adapter

Layer 3: Core Logic (depend on Layer 2)

ModuleDependencies
executor.pyOmniRoute HTTP, A2A HTTP (stdlib + urllib)
adversarial_reviewer.pylenses/*.py
director.pyexecutor, scoring, context_orchestrator, anchor_loader, adversarial_reviewer, trajectory, bookbag, decision_log, triage_classifier
routing.pyscoring

Layer 4: Entry Points (depend on Layer 3)

ModuleDependencies
conductor.pydirector, scoring, bookbag
mcp_server.pydirector, routing, scoring, executor, context_orchestrator, trajectory
autonomous_loop.pydirector, scoring
cli.pyscoring
issue_bridge.pyscoring, triage_classifier
staff/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)

#TaskFilesDepends On
A1Switch MCP server from SYSTEM_PROMPTS to ROLE_SYSTEM_PROMPTSmcp_server.pyNothing
A2Add role parameter to enrich_prompt call in school_executemcp_server.pyA1
A3Inject semantic anchors via _anchor_context() in MCP handlersmcp_server.pyA1
A4Remove dead "Foundry" backend reference from _backend_for_agentmcp_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)

#TaskFilesDepends On
B1Call verify_gate.run_verify_gate() inside _run_two_judge_review() when domain has executable outputdirector.py, verify_gate.pyNothing
B2Feed execution failures as CRITICAL findings into CTO reviewdirector.pyB1

Workstream C: Dead Code Cleanup

Blast radius: Low — nothing depends on these
Effort: Small

#TaskFilesDepends On
C1Fix test_anchor_loader.py — remove from prompt_composer import compose_prompttests/test_anchor_loader.pyNothing
C2Fix test_role_loader.py — remove from prompt_composer import ROLE_ANCHORStests/test_role_loader.pyNothing
C3Delete prompt_composer.pyprompt_composer.pyC1, C2
C4Delete dead prompt_composer.py reference in anchor_loader.py docstringanchor_loader.pyNothing

Workstream D: Browser Role Anchors

Blast radius: config/anchors.yaml + director.py
Risk: Low — additive only
Effort: Small (~5 anchors)

#TaskFilesDepends On
D1Add web-automation domain anchors to config/anchors.yaml (e.g., Page Object Model, Selector Strategy, Wait Strategy)config/anchors.yamlNothing
D2Add web-automation domain to browser's ROLE_ANCHOR_DOMAINSdirector.pyD1

Workstream E: Auth Token Security

Blast radius: executor.py
Risk: Low — env var fallback only
Effort: Tiny (~3 lines)

#TaskFilesDepends On
E1Read API_KEY from env var with fallback to hardcoded valueexecutor.pyNothing

Workstream F: Documentation Sync

Blast radius: campus.md
Risk: Trivial
Effort: Small

#TaskFilesDepends On
F1Update campus.md to reflect current Principal→CTO+COO architecture (the aspirational table was last updated — verify it matches)campus.mdNothing
F2Document the 5 specialized roles, bookbag schema, and Orca dispatch flowcampus.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):

BatchTasksFiles changed
Batch 1A1, A4 (MCP role switch + Foundry removal)mcp_server.py
Batch 2B1 (Verify gate wiring)director.py
Batch 3C1, C2, C4 (Test fixes + docstring fix)tests/test_anchor_loader.py, tests/test_role_loader.py, anchor_loader.py
Batch 4D1 (Anchors YAML)config/anchors.yaml
Batch 5E1 (Auth token env var)executor.py
Batch 6F1 (Campus docs)campus.md

Phase 2 — Sequential (depends on Phase 1):

BatchTasksDepends on
Batch 7A2, A3 (MCP role param + anchors)Batch 1 (A1)
Batch 8B2 (Execution failures as findings)Batch 2 (B1)
Batch 9C3 (Delete prompt_composer.py)Batch 3 (C1, C2)
Batch 10D2 (Browser domain mapping)Batch 4 (D1)
Batch 11F2 (Detailed docs)Batch 6 (F1)

What NOT To Do (Out of Scope)

ThingWhy
Wire Serena/CodeGraph MCP into executor.pyMassive architectural change — needs MCP client integration, not a quick wiring
Rebuild student execution pipelineThe current text-completion-only model is a design choice; changing it is a v2 problem
Add web-automation anchors for browserD1 covers this, but the actual anchors content needs you to decide which methodologies fit
Add new roles or domainsWould require new seeds, new prompts, new COMBO_MAP entries — beyond audit scope
Refactor scoring.py EMA weightsWould 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

FileHow many imports itWho imports itCan it change alone?
mcp_server.py0 (no one imports it)—✅ Yes, fully isolated
executor.py6 filesdirector, mcp_server, routing⚠️ Needs test pass after
director.py4 filesconductor, mcp_server, autonomous_loop, issue_bridge⚠️ Needs test pass after
prompt_composer.py2 test filestest_anchor_loader, test_role_loader✅ Can delete cleanly
config/anchors.yaml1 fileanchor_loader (runtime)✅ Yes, additive only
verify_gate.py0 (unused)—✅ Yes, fully isolated
campus.md0—✅ Yes, docs only
anchor_loader.py1 filedirector⚠️ Needs test pass
Built with LogoFlowershow