Skip to content

orchestrator-state.md not created in session 2026-02-16-1771285110 #2

Description

@Number531

Summary

Session 2026-02-16-1771285110 completed without creating orchestrator-state.md, causing the orchestrator to lose phase tracking context after the 7th context compaction. This directly contributed to the session declaring "PROCESS COMPLETE" at QA score 78/100 without executing Phase A3 remediation.

What happened

The orchestrator generated a 215,386-word memorandum across 12 sections (34 subagents, 222 turns, 835 tool calls), then ran QA diagnostic which scored 78/100 (NEEDS_REMEDIATION, TIER_3_FULL, 37 issues). After the 7th context compaction at the critical A2→A3 transition, the model lost awareness of the remediation mandate and declared the process complete.

Without orchestrator-state.md, there was no recovery mechanism — the model had no file to read post-compaction to understand what phase it was in or what remained to be done.

Root cause

orchestrator-state.md creation is prompt-driven — no code generates it. The model creates it based on instructions in its system prompt. Three factors eliminated those instructions:

  1. memorandum-orchestrator.md is orphaned — contains the orchestrator-state.md schema (lines 399-476) and Phase A3 protocol (lines 714+), but is never loaded into the model's system prompt. _promptLoader.js:116-120 explicitly says "This path is not used in production."

  2. MODULAR_SUBAGENTS=true (set by commit e9f563d) — switched from legacy monolithic legalSubagents.js to modular legalSubagents/ directory. The legacy file contained 40+ references to orchestrator-state.md in agent definitions that served as implicit context cues. The modular SUBAGENT_SYSTEM_PROMPT_SECTION in _promptConstants.js had zero mentions of orchestrator-state.md, DEAL_METADATA, or the A2→A3 gate.

  3. 7 prior sessions created it successfully — because they ran before e9f563d with MODULAR_SUBAGENTS=false, inheriting the implicit cues from the legacy monolithic file.

Resolution

Fixed in a prior session. Orchestrator state management instructions were added to SUBAGENT_SYSTEM_PROMPT_SECTION in _promptConstants.js at line 2076, including:

  • ## ORCHESTRATOR STATE MANAGEMENT (MANDATORY FOR COMPLEX QUERIES) — creation instructions with DEAL_METADATA schema and phase tracking table
  • Phase A2→A3 Gate — explicit instructions to read qa-diagnostic-state.json and execute remediation if score < 88
  • Compaction Recovery Protocol — instructions to read orchestrator-state.md first after context loss
  • Same content added to legacy legalSubagents.js to maintain test parity (legalSubagents-migration.test.js)

Files affected

  • src/config/legalSubagents/_promptConstants.js — added ~70-line orchestrator state management section
  • src/config/legalSubagents.js — matching addition for legacy parity
  • prompts/memorandum-orchestrator.md — remains orphaned (source reference only)

Verification

grep -c 'ORCHESTRATOR STATE MANAGEMENT' src/config/legalSubagents/_promptConstants.js
# Expected: 1

grep -c 'DEAL_METADATA' src/config/legalSubagents/_promptConstants.js
# Expected: 3+

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions