Skip to content

HL โ€” TFW-24: Researcher Role & RES State Machine

Date: 2026-04-04 Author: Coordinator Status: ๐Ÿ“ HL_DRAFT โ€” Awaiting review


1. Goal & Value

Goal: Split Researcher into a standalone role with dedicated workflow, and enforce research stage completion through filesystem-level state machine (subfolder with stage files).

Value: Research becomes crash-resilient, multi-chat resumable, and structurally impossible to skip stages. Role confusion between Coordinator and Researcher is eliminated.

"File existence = state machine. Agent can't skip stages โ€” no file = not done."

2. Current State (As-Is)

Problem Evidence Impact
Research = "Coordinator in Research Mode" base.md L7: ROLE LOCK: COORDINATOR (Research Mode) User confused Plan vs Research in TFW-24 inception
Gates are decorative โ†’ User decision: ___ โ€” 6/6 unfilled in TFW-23 No enforcement, no state persistence
No resume inside research /tfw-resume at pipeline level only Crash mid-stage = chaos
Gate responses lost with chat Approvals exist only in chat New chat = no record
3 roles cover 4 functions Coordinator = planning + research Same problem TFW-8 solved for Reviewer

Historical pattern

[TFW-8](../TFW-8__reviewer_role_and_workflow/HL-TFW-8__reviewer_role_and_workflow.md):  Executor + Reviewer merged โ†’ self-review โ†’ Reviewer role extracted
[TFW-24](HL-TFW-24__res_state_machine.md): Coordinator + Researcher merged โ†’ role confusion + crash fragility โ†’ Researcher role extracted

3. Target State (To-Be)

4 roles: Coordinator (HL, TS), Researcher (RES, stage files), Executor (ONB, RF, code), Reviewer (REVIEW). Research uses subfolder with stage files as filesystem-level state machine.

3.1 Result Visualization

Role separation:

BEFORE (3 roles):                    AFTER (4 roles):
  Coordinator โ”€โ”ฌโ”€ HL, TS              Coordinator โ”€โ”€ HL, TS
               โ””โ”€ RES (mode switch)   Researcher โ”€โ”€โ”€ RES, stage files  โ† NEW
  Executor โ”€โ”€โ”€โ”€ ONB, RF, code         Executor โ”€โ”€โ”€โ”€โ”€ ONB, RF, code
  Reviewer โ”€โ”€โ”€โ”€ REVIEW                Reviewer โ”€โ”€โ”€โ”€โ”€ REVIEW

Research subfolder (filesystem = state machine):

tasks/TFW-24__res_state_machine/
  HL-TFW-24__res_state_machine.md
  research/                           โ† state machine
    briefing.md                       โ† exists = briefing done
    gather.md                         โ† exists = gather done
    extract.md                        โ† exists = extract done
    challenge.md                      โ† exists = challenge done
  RES__TFW-24__res_state_machine.md   โ† exists = synthesis done

Resume algorithm (Step 0 in base.md):

1. research/ exists?  โ†’ NO: start fresh
2. Which files exist? โ†’ resume from first missing
3. RES exists?        โ†’ research complete, proceed to Closure

Pipeline handoff:

Coordinator (plan.md)        Researcher (base.md)         Coordinator (plan.md)
  HL approved                  reads HL                     reads RES Closure
  "Start /tfw-research"       runs stages                  updates HL
  โ”€โ”€ STOP โ”€โ”€                   writes RES                   writes TS
                               โ”€โ”€ STOP โ”€โ”€

4. Phases

Phase A: Researcher Role + Subfolder State Machine ๐Ÿ”ด

  • Researcher role in conventions.md ยง15, ยง8, glossary.md
  • research/base.md Role Lock โ†’ RESEARCHER
  • Step 0 (Resume Protocol) in base.md
  • Research subfolder convention in conventions.md ยง4
  • Stage file structure (lightweight: Goal ref + Findings + Checkpoint)
  • Step 7 โ†’ Synthesis step (write final RES from stage files)
  • plan.md Step 6 โ†’ explicit handoff to Researcher with Hard Stop
  • templates/RES.md โ†’ synthesis format (Decisions, Hypotheses, HL Recommendations, FC, Conclusion)
  • HL template ยง1 โ†’ Goal & Value structured fields
  • HL template ยง2, ยง5 โ†’ domain-agnostic language
  • PROJECT_CONFIG.yaml RES status role โ†’ researcher
  • Adapter sync

5. Definition of Done (DoD)

  • โœ… 1. Researcher role defined in conventions.md ยง15 (Role Lock table) and ยง8 (Workflows table)
  • โœ… 2. Researcher role defined in glossary.md with Permitted/Forbidden artifacts
  • โœ… 3. research/base.md Role Lock = ๐Ÿ”’ ROLE LOCK: RESEARCHER
  • โœ… 4. research/base.md has Step 0: Resume Protocol (~30 words)
  • โœ… 5. research/base.md Step 3 โ†’ creates research/ subfolder with stage files
  • โœ… 6. research/base.md Step 7 โ†’ Synthesis step (consolidate stage files โ†’ final RES)
  • โœ… 7. conventions.md ยง4 โ†’ research subfolder convention documented
  • โœ… 8. Stage file structure defined: Goal ref + Findings + Checkpoint
  • โœ… 9. plan.md Step 6 โ†’ handoff to Researcher role (not self-switch), Hard Stop
  • โœ… 10. templates/RES.md โ†’ synthesis format (no stage sections, different structure from stage files)
  • โœ… 11. templates/HL.md ยง1 โ†’ Goal & Value structured fields
  • โœ… 12. templates/HL.md ยง2, ยง5 โ†’ domain-agnostic language
  • โœ… 13. PROJECT_CONFIG.yaml RES status role = researcher
  • โœ… 14. No references to "Coordinator (Research Mode)" remain in .tfw/
  • โœ… 15. Adapters synced (.agent/, .claude/)
  • โœ… 16. Word count: base.md โ‰ค 600 words

6. Definition of Failure (DoF)

  • โŒ 1. base.md exceeds 600 words โ†’ compress Step 0 or move subfolder logic to conventions ref
  • โŒ 2. Final RES structure too similar to stage files โ†’ copy-paste risk, synthesis fails
  • โŒ 3. Role separation creates pipeline ambiguity at handoff โ†’ clarify in plan.md

On failure: Compress. Ref-inside-step for subfolder details. Reduce stage file structure to bare minimum.

7. Principles

  1. One role, one artifact type โ€” Researcher writes RES + stage files. Coordinator writes HL/TS. No mode switching
  2. Filesystem = state machine โ€” File existence is enforcement. No parsing, no format compliance, no update discipline. Missing file = stage not done
  3. Synthesis, not aggregation โ€” Final RES has different structure from stage files. Impossible to copy-paste. Forces integrated thinking
  4. Resume from anywhere โ€” Step 0: read subfolder โ†’ know exact state โ†’ continue. Zero dependency on chat history

8. Dependencies

Dependency Status
TFW-22 (modular research architecture) โœ… Done
TFW-23 (English templates) โœ… Done
TFW-8 (Reviewer role split precedent) โœ… Done

9. Risks

Risk Probability Impact Mitigation
base.md exceeds 600 words Medium Medium Step 0 = ~30 words. Synthesis instruction = ~20. Total ~70 new
Consolidation = copy-paste not synthesis Medium High RES template structure โ‰  stage file structure (D2)
Role split adds pipeline friction Low Medium Same pattern as TFW-8. Clean handoff/handback
Crash mid-stage-file write Low Low Accept partial file. Agent reads content, assesses completeness (C1)

10. RESEARCH Case

Blind Spots

  • ~~How should Step 0 work?~~ โ†’ Answered (D1: filesystem check)
  • ~~What format for state tracking?~~ โ†’ Answered (D1: file existence, not table)

Hypotheses

# Hypothesis Status
H1 State in RES file sufficient for crash recovery โœ… confirmed โ†’ evolved to D1: subfolder = state machine
H2 Researcher = pure relabeling of Coordinator Research Mode ๐ŸŸก partial โ€” relabeling yes, but subfolder architecture = new workflow logic
H3 State Table format within 10 lines โšซ superseded โ€” file existence replaces table
H4 Word budget โ‰ค600 achievable โœ… confirmed โ€” 518 + ~70 = ~588

Risks of Not Researching

N/A โ€” research completed.

Proposed RESEARCH Focus

N/A โ€” research completed. Key findings: D1 (subfolder = state machine), D2 (synthesis โ‰  aggregation), D3 (absolute role split), D4 (Goal & Value in HL), D5 (stage file naming).


HL โ€” TFW-24: Researcher Role & RES State Machine | 2026-04-04