@techierathore/techieflow 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/.claude/commands/TechieFlow/agents/analyst.md +5 -8
  2. package/.claude/commands/TechieFlow/agents/architect.md +1 -10
  3. package/.claude/commands/TechieFlow/agents/flow-master.md +1 -0
  4. package/.claude/commands/TechieFlow/agents/verifier.md +1 -0
  5. package/.claude/commands/TechieFlow/tasks/_owner-language.md +26 -0
  6. package/.claude/commands/TechieFlow/tasks/_smoke-test-policy.md +1 -1
  7. package/.claude/commands/TechieFlow/tasks/amend-docs.md +6 -5
  8. package/.claude/commands/TechieFlow/tasks/build-phase.md +1 -1
  9. package/.claude/commands/TechieFlow/tasks/create-deep-research-prompt.md +4 -0
  10. package/.claude/commands/TechieFlow/tasks/create-doc.md +4 -0
  11. package/.claude/commands/TechieFlow/tasks/create-project-brief.md +22 -0
  12. package/.claude/commands/TechieFlow/tasks/day1-brownfield.md +2 -2
  13. package/.claude/commands/TechieFlow/tasks/day1-greenfield.md +2 -2
  14. package/.claude/commands/TechieFlow/tasks/facilitate-brainstorming-session.md +4 -0
  15. package/.claude/commands/TechieFlow/tasks/generate-html.md +5 -1
  16. package/.claude/commands/TechieFlow/tasks/handoff-phase.md +18 -16
  17. package/.claude/commands/TechieFlow/tasks/metrics-report.md +2 -0
  18. package/.claude/commands/TechieFlow/tasks/verify-phase.md +1 -1
  19. package/.opencode/plugin/techieflow.js +2 -2
  20. package/.tfcore/agents/analyst.md +5 -8
  21. package/.tfcore/agents/architect.md +1 -10
  22. package/.tfcore/agents/flow-master.md +1 -0
  23. package/.tfcore/agents/verifier.md +1 -0
  24. package/.tfcore/hooks/guard-metrics.sh +13 -1
  25. package/.tfcore/hooks/guard-verify-deps.sh +124 -0
  26. package/.tfcore/routing.yaml +61 -0
  27. package/.tfcore/tasks/_owner-language.md +26 -0
  28. package/.tfcore/tasks/_smoke-test-policy.md +1 -1
  29. package/.tfcore/tasks/amend-docs.md +6 -5
  30. package/.tfcore/tasks/build-phase.md +1 -1
  31. package/.tfcore/tasks/create-deep-research-prompt.md +4 -0
  32. package/.tfcore/tasks/create-doc.md +4 -0
  33. package/.tfcore/tasks/create-project-brief.md +22 -0
  34. package/.tfcore/tasks/day1-brownfield.md +2 -2
  35. package/.tfcore/tasks/day1-greenfield.md +2 -2
  36. package/.tfcore/tasks/facilitate-brainstorming-session.md +4 -0
  37. package/.tfcore/tasks/generate-html.md +5 -1
  38. package/.tfcore/tasks/handoff-phase.md +18 -16
  39. package/.tfcore/tasks/metrics-report.md +2 -0
  40. package/.tfcore/tasks/verify-phase.md +1 -1
  41. package/.tfcore/telemetry/SCHEMA.md +57 -1
  42. package/.tfcore/telemetry/tf-metrics.sh +416 -19
  43. package/.tfcore/templates/v4custom/app-brief-tmpl.md +65 -0
  44. package/.tfcore/templates/v4custom/app-decision-request-tmpl.md +85 -0
  45. package/.tfcore/templates/v4custom/app-library-feedback-tmpl.md +86 -31
  46. package/.tfcore/templates/v4custom/html-render-shell.md +1 -1
  47. package/.tfcore/utils/__pycache__/tf-brd-status.cpython-312.pyc +0 -0
  48. package/.tfcore/utils/__pycache__/tf-checklist-edit.cpython-312.pyc +0 -0
  49. package/.tfcore/utils/__pycache__/tf-day1-files.cpython-312.pyc +0 -0
  50. package/.tfcore/utils/__pycache__/tf-devguide-list.cpython-312.pyc +0 -0
  51. package/.tfcore/utils/__pycache__/tf-doc-check.cpython-312.pyc +0 -0
  52. package/.tfcore/utils/__pycache__/tf-log-miss.cpython-312.pyc +0 -0
  53. package/.tfcore/utils/__pycache__/tf-misses-md.cpython-312.pyc +0 -0
  54. package/.tfcore/utils/__pycache__/tf-mockups-locate.cpython-312.pyc +0 -0
  55. package/.tfcore/utils/__pycache__/tf-opencode-audit.cpython-312.pyc +0 -0
  56. package/.tfcore/utils/__pycache__/tf-perf-grade.cpython-312.pyc +0 -0
  57. package/.tfcore/utils/__pycache__/tf-render-html.cpython-312.pyc +0 -0
  58. package/.tfcore/utils/__pycache__/tf-split-brd.cpython-312.pyc +0 -0
  59. package/.tfcore/utils/__pycache__/tf-status-facts.cpython-312.pyc +0 -0
  60. package/.tfcore/utils/__pycache__/tf-triage.cpython-312.pyc +0 -0
  61. package/.tfcore/utils/__pycache__/tf-verify-list.cpython-312.pyc +0 -0
  62. package/.tfcore/utils/__pycache__/tf-verify-verdict.cpython-312.pyc +0 -0
  63. package/.tfcore/utils/tf-build-list.py +23 -3
  64. package/.tfcore/utils/tf-build-list.sh +3 -2
  65. package/.tfcore/utils/tf-doc-check.py +106 -4
  66. package/.tfcore/utils/tf-emit.sh +353 -16
  67. package/.tfcore/utils/tf-fix-close.sh +34 -2
  68. package/.tfcore/utils/tf-gitignore-audit.sh +50 -3
  69. package/.tfcore/utils/tf-goal.sh +93 -6
  70. package/.tfcore/utils/tf-misses-md.py +14 -17
  71. package/.tfcore/utils/tf-misses-md.sh +5 -4
  72. package/.tfcore/utils/tf-model-pick.sh +475 -0
  73. package/.tfcore/utils/tf-phase.sh +18 -0
  74. package/.tfcore/utils/tf-render-html.py +20 -0
  75. package/.tfcore/utils/tf-routing-bind.sh +87 -1
  76. package/.tfcore/utils/tf-routing.sh +7 -0
  77. package/.tfcore/utils/tf-selfcheck.sh +323 -0
  78. package/.tfcore/utils/tf-split-brd.py +6 -1
  79. package/.tfcore/utils/tf-status-facts.py +61 -12
  80. package/.tfcore/utils/tf-verify-screens.mjs +85 -13
  81. package/.tfcore/utils/tf-verify-screens.sh +12 -3
  82. package/.tfcore/utils/tf-verify-tests.sh +60 -17
  83. package/.tfcore/utils/tf-verify-verdict.py +11 -2
  84. package/README.md +15 -5
  85. package/opencode.jsonc +24 -0
  86. package/package.json +1 -1
  87. package/scripts/install.mjs +4 -0
  88. package/.tfcore/templates/architecture-tmpl.yaml +0 -650
  89. package/.tfcore/templates/brownfield-architecture-tmpl.yaml +0 -476
  90. package/.tfcore/templates/competitor-analysis-tmpl.yaml +0 -306
  91. package/.tfcore/templates/front-end-architecture-tmpl.yaml +0 -218
  92. package/.tfcore/templates/fullstack-architecture-tmpl.yaml +0 -823
  93. package/.tfcore/templates/market-research-tmpl.yaml +0 -252
  94. package/.tfcore/templates/project-brief-tmpl.yaml +0 -221
  95. package/.tfcore/utils/techieflow-doc-template.md +0 -325
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env bash
2
+ # TechieFlow PreToolUse hook — a verify run may START a dependency, never CREATE one,
3
+ # and never point the application at a different one.
4
+ #
5
+ # TfLens, 2026-09-01 (MISS-TfLens-20260901-02). The configured dev database was refusing
6
+ # connections. The agent ran `docker compose up -d db || docker compose up -d` — the
7
+ # service is named `postgres`, so the `||` fallback executed the BARE compose command and
8
+ # started every service, creating an application container and image the owner had to
9
+ # delete by hand. It then exported the connection-string variable to point the whole test
10
+ # suite at a different PostgreSQL and reported "689/689 pass" against it.
11
+ #
12
+ # Both halves are the same error. A verify run's entire product is trustworthy verdicts,
13
+ # and verdicts measured against a system nobody chose are not weaker evidence — they are
14
+ # evidence about a DIFFERENT system, reported under the checklist's name. The empty
15
+ # substitute database then produced RENDER-EMPTY on nine controls whose real cause was
16
+ # "no data", which is the plausible-wrong-number failure this framework exists to prevent,
17
+ # arriving inside the verifier itself.
18
+ #
19
+ # §1 was already strict about unasked-for FILES (tests/.artifacts/, guard-artifacts.sh) and
20
+ # silent about unasked-for INFRASTRUCTURE. A container, a volume and an image are exactly
21
+ # as much machine state as a stray directory. This hook is that rule, as a rule and not a
22
+ # paragraph (maintenance contract 3).
23
+ #
24
+ # REFUSES:
25
+ # - `docker compose up` / `docker-compose up` with no service named
26
+ # - any `|| docker compose up` fallback, which widens the command precisely when it failed
27
+ # - `docker compose run|create`, `docker run`, `docker volume create` — creating, not starting
28
+ # - an inline or exported connection-string variable in front of a test/run command
29
+ # ALLOWS: `docker start <name>`, `docker compose up <service>`, `docker compose start`,
30
+ # `docker ps|logs|inspect`, and anything that is not one of the above.
31
+ #
32
+ # Wired in .claude/settings.json -> hooks.PreToolUse (matcher "Bash"); OpenCode via
33
+ # .opencode/plugin/techieflow.js. Exit 2 + stderr = block and feed the message back.
34
+ # Fails OPEN (exit 0) if python3 or parseable JSON is unavailable — a guard that cannot
35
+ # read its input must not stop the run.
36
+ #
37
+ # Tested by tests/regression/run.sh tf_013.
38
+
39
+ INPUT="$(cat)"
40
+ command -v python3 >/dev/null 2>&1 || exit 0
41
+
42
+ TF_HOOK_INPUT="$INPUT" python3 - <<'PY'
43
+ import json, os, re, sys
44
+
45
+ try:
46
+ data = json.loads(os.environ.get("TF_HOOK_INPUT", ""))
47
+ except Exception:
48
+ sys.exit(0)
49
+
50
+ cmd = (data.get("tool_input") or {}).get("command")
51
+ if not isinstance(cmd, str) or not cmd.strip():
52
+ sys.exit(0)
53
+
54
+ def block(what, instead):
55
+ print("BLOCKED by TechieFlow policy: %s\n"
56
+ "A verify run may START a service the project already defines; it may not CREATE "
57
+ "one, and it may never measure the application against a different instance — a "
58
+ "green suite against the wrong database is worse than a red one, because it is "
59
+ "quotable.\n%s\n"
60
+ "If the dependency is down and you cannot start the project's own definition of "
61
+ "it BY NAME, stop and ask, naming the one command the owner should run. Record "
62
+ "the resolved target (host, port, database — never credentials) in the verify "
63
+ "report, so which system was measured is on the face of it."
64
+ % (what, instead), file=sys.stderr)
65
+ sys.exit(2)
66
+
67
+ # --- creating infrastructure, rather than starting what the project already defines ------
68
+ COMPOSE = r"docker(?:\s+compose|-compose)"
69
+
70
+ # a bare `up`: no service name before the end of the segment. Flags are not service names.
71
+ for seg in re.split(r"(?:\|\||&&|;|\||\n)", cmd):
72
+ seg = seg.strip()
73
+ m = re.search(COMPOSE + r"\s+up\b(.*)$", seg, re.I)
74
+ if m:
75
+ rest = m.group(1)
76
+ # drop flags and their values; whatever is left is a service name
77
+ words = [w for w in re.split(r"\s+", rest.strip()) if w]
78
+ svc = []
79
+ skip = False
80
+ for w in words:
81
+ if skip:
82
+ skip = False
83
+ continue
84
+ if w.startswith("-"):
85
+ if "=" not in w and w in ("--scale", "--timeout", "--project-name", "-p", "--file", "-f"):
86
+ skip = True
87
+ continue
88
+ svc.append(w)
89
+ if not svc:
90
+ block("`%s` starts EVERY service in the compose file." % seg[:120],
91
+ "Name the service: `docker compose up -d <service>` — and check the name, "
92
+ "because a `|| docker compose up` fallback runs the bare command exactly "
93
+ "when the named one was wrong.")
94
+
95
+ if re.search(r"\|\|\s*" + COMPOSE + r"\s+up\b", cmd, re.I):
96
+ block("a `|| docker compose up` fallback widens the command when the named service failed.",
97
+ "Drop the fallback. If the named service does not exist, the name is wrong — fix "
98
+ "the name or ask; do not start everything instead.")
99
+
100
+ if re.search(COMPOSE + r"\s+(?:run|create)\b", cmd, re.I) or \
101
+ re.search(r"\bdocker\s+(?:run|create)\b", cmd, re.I) or \
102
+ re.search(r"\bdocker\s+volume\s+create\b", cmd, re.I):
103
+ block("this CREATES container or volume state the owner did not ask for.",
104
+ "Start what the project defines: `docker start <name>` or `docker compose up -d <service>`.")
105
+
106
+ # --- repointing the application at a different instance ----------------------------------
107
+ # The variable is whatever the project named it, so match the SHAPE of a connection string
108
+ # rather than a list of names that would never be complete.
109
+ CONNSTR = r"(?:Host|Server|Data\s*Source|Endpoint)\s*=|(?:postgres|postgresql|mysql|mongodb|mssql|sqlserver|redis)(?:\+srv)?://"
110
+ ASSIGN = r"(?:\bexport\s+|\bset\s+|^|\s|;|&&)([A-Za-z_][A-Za-z0-9_]*)\s*=\s*[\"']?([^\"'\s;&|]*)"
111
+
112
+ for m in re.finditer(ASSIGN, cmd):
113
+ name, val = m.group(1), m.group(2)
114
+ if re.search(CONNSTR, val, re.I) or (re.search(r"conn|db|database|datasource", name, re.I)
115
+ and re.search(r"[=:]//|Host\s*=|Port\s*=", val, re.I)):
116
+ block("`%s` points the application or its tests at a connection string chosen here, "
117
+ "not the one the project is configured with." % name,
118
+ "Use the app's own configured connection. TfLens's own test helper already "
119
+ "carries this rule — \"there is deliberately no default here … so tests and app "
120
+ "can never drift onto different servers again\" — and it cost a day to learn.")
121
+
122
+ sys.exit(0)
123
+ PY
124
+ exit $?
@@ -38,6 +38,8 @@
38
38
  # .opencode/opencode.json). Nothing changes until it runs.
39
39
  # 4. For one unattended run only, pass --model <id> to tf-goal.sh instead; the main agent uses
40
40
  # it, the sub-agents still use the bindings from step 3.
41
+ # 5. When a model's usage limit is reached, the tier's `fallbacks:` list is the answer — see the
42
+ # block below. Nothing is automatic until a limit is actually hit.
41
43
  enabled: true
42
44
  # ---------------------------------------------------------------------------
43
45
  # Tier → model id, per harness. STARTING VALUES — the owner tunes these.
@@ -54,6 +56,65 @@ tiers:
54
56
  claude: haiku
55
57
  opencode: openai/gpt-5.6-luna
56
58
 
59
+ # ---------------------------------------------------------------------------
60
+ # Tier → the models to try INSTEAD, in order, while the tier model is limited.
61
+ # Comma-separated, one line per harness, same flat two-space shape as `tiers:`.
62
+ #
63
+ # WHAT USES IT. `bash .tfcore/utils/tf-model-pick.sh pick <tier> <harness>` returns the first
64
+ # model in "tier model, then this list" that is NOT on cooldown. tf-goal.sh puts a model on
65
+ # cooldown when a cycle ends in a usage limit, re-binds, and starts the next cycle on the next
66
+ # model; tf-routing-bind.sh reads the same answer, so the sub-agents move with the main agent
67
+ # instead of failing behind it. A cooldown expires by itself at the reset time the limit message
68
+ # stated, and the tier goes back to its own model.
69
+ #
70
+ # WHEN IT DOES NOT HELP, stated plainly: on Claude Code the 5-hour and weekly limits are the
71
+ # ACCOUNT's, not the model's, so a fallback to another Claude model is limited too. The supervisor
72
+ # finds that out the honest way — the next cycle hits the same limit, that model goes on cooldown
73
+ # as well, and once the chain is exhausted it sleeps until the reset exactly as it did before.
74
+ # A per-model limit (Opus exhausted while the account is fine) is where the Claude column earns
75
+ # its keep; a provider outage or a monthly balance is where the OpenCode column does.
76
+ #
77
+ # Empty list = no fallback for that tier; the supervisor sleeps. That is the safe default for
78
+ # anyone who does not want a phase silently running on a different model.
79
+ #
80
+ # WHERE THE "limited until <time>" RECORD IS KEPT. In this project, at
81
+ # .tfcore/.session/model-cooldown.json — the framework is installed per project, so its state is
82
+ # per project too, and one project's setting never reaches another. Uncomment the line below to
83
+ # move it: a path relative to the project root, or an absolute one. Several projects pointed at
84
+ # one file learn about a limit from each other instead of each finding it out for themselves.
85
+ # cooldown_file: .tfcore/.session/model-cooldown.json
86
+ # ---------------------------------------------------------------------------
87
+ # The OpenCode lines below are OpenCode Go models (https://opencode.ai/docs/go — a $10/month plan
88
+ # with a per-model monthly allowance, which is exactly the limit these chains exist for). Each tier
89
+ # falls back to a DIFFERENT model, because the allowance that ran out is per model, and then to a
90
+ # different provider, because a whole plan can run out at once.
91
+ fallbacks:
92
+ frontier:
93
+ claude: opus, haiku
94
+ opencode: opencode-go/glm-5.3, opencode-go/kimi-k3, openai/gpt-5.6-sol
95
+ standard:
96
+ claude: haiku
97
+ opencode: opencode-go/mimo-v2.5, opencode-go/qwen3.8-max, openai/gpt-5.6-luna
98
+ economy:
99
+ claude: sonnet
100
+ opencode: opencode-go/deepseek-v4-flash, opencode-go/glm-5.3-flash, openai/gpt-5.6-luna
101
+
102
+ # ---------------------------------------------------------------------------
103
+ # How each harness is PAID FOR. This is what stops one `cost_usd` column pooling
104
+ # three different kinds of number (SCHEMA.md §2.5b).
105
+ # subscription a flat fee buys a quota. Marginal dollars are zero; the unit that means
106
+ # anything is tokens. Claude Max, and any OpenCode provider signed in with OAuth.
107
+ # metered an API key billed per token. The dollars are real money and are summed.
108
+ # local a model on this machine. No quota, no bill.
109
+ # auto work it out per model — OpenCode's own auth.json says oauth or api, and a
110
+ # provider it has never heard of that answers locally is local.
111
+ # `auto` is right for OpenCode because one machine mixes all three at once. Claude Code is
112
+ # declared, because nothing in a transcript says which plan paid for it.
113
+ # ---------------------------------------------------------------------------
114
+ billing:
115
+ claude: subscription
116
+ opencode: auto
117
+
57
118
  # ---------------------------------------------------------------------------
58
119
  # Phase → tier. One line each; values: frontier | standard | economy | inherit.
59
120
  # Rationale per row: docs/Adapter-Design.md §5.6 (the tier map is a HYPOTHESIS
@@ -0,0 +1,26 @@
1
+ # _owner-language — how anything addressed to the owner is written
2
+
3
+ Loaded by every persona. **The shape of a document lives in that document's template, never here.** These are the three rules that apply when no particular document is being written.
4
+
5
+ ## 1. Plain, simple English
6
+
7
+ Everything the owner reads — a terminal reply, a document, a status line, the sentence on a miss — is written for a capable person who has not read one line of this framework.
8
+
9
+ - **No coined terms, no shorthand.** "the framework's own script", not "the oracle". "the number you divide by", not "the denominator". If the owner would have to look a word up, it is the wrong word.
10
+ - **Writing a glossary means the words are wrong.** Change the words. `tf-doc-check.sh` refuses a glossary section.
11
+ - First sentence carries the answer. Name the thing, not its id. Short sentences. Never dramatise.
12
+
13
+ ## 2. A question for the owner goes in a file, not in the conversation
14
+
15
+ When a command hits a choice only the owner can make and the answer changes what gets built: write `docs/{App}-Decision-Request.md` from `app-decision-request-tmpl.md`, render it with `tf-render-html.sh`, check it with `tf-doc-check.sh`, then say **one line** in the terminal — which file, how many decisions. Nothing else: restating it in the terminal buries the question in the context the file exists to keep clear.
16
+
17
+ Never read a Decision Request back in. The owner's pasted block is the input. In YOLO, take a choice that has a clear recommendation, mark it, and continue; write the file only for one you genuinely cannot take alone.
18
+
19
+ ## 3. Reporting a problem upstream is never refused
20
+
21
+ A gap in the framework or in a library is filed on the day you find it, whatever its size, without asking permission. The shape is in `app-library-feedback-tmpl.md`. Two things bind wherever you are:
22
+
23
+ - **Every entry answers `Blocks:` first — `yes` or `no`.** That word decides whether the run stops.
24
+ - **A non-blocking entry is filed and the work carries on.** No stopping, no asking, no page of analysis mid-run. One entry, then continue, and one line about it when the command ends.
25
+
26
+ A defect goes in the feedback file. A question goes in a Decision Request. Never mixed: different readers.
@@ -12,7 +12,7 @@ A screen passes only if all three hold, at a desktop width and a mobile width:
12
12
 
13
13
  A failure on any of the three is a defect: write it into the row's Remarks (prefix `⚠ visual:` for 2 and 3) and do not report the row done. A smoke earns a row at most `Implemented`; only an executed verify run writes `Verified`.
14
14
 
15
- The evidence of a smoke is the file `bash .tfcore/utils/tf-verify-screens.sh --screen <name>=<route> … --base <url>` writes (`tests/.artifacts/verify/screens.json`, with a screenshot per screen and width); a row is written `Implemented` only after that run, and its Remark names the file. The application is booted with `bash .tfcore/utils/tf-verify-boot.sh start`, which also drives a Blazor Hybrid Windows head; a head the script cannot boot leaves the row below `Implemented` with the reason.
15
+ The evidence of a smoke is the file `bash .tfcore/utils/tf-verify-screens.sh --screen <name>=<route> … --base <url>` writes (`tests/.artifacts/verify/screens.json`, with a screenshot per screen and width); a row is written `Implemented` only after that run, and its Remark names the file. The application is booted with `bash .tfcore/utils/tf-verify-boot.sh start`, which also drives an embedded-browser desktop head Windows head; a head the script cannot boot leaves the row below `Implemented` with the reason.
16
16
 
17
17
  ## Run it yourself
18
18
 
@@ -14,13 +14,14 @@ First: `bash .tfcore/utils/tf-phase.sh start amend-docs {App}` prints the start
14
14
 
15
15
  1. Read the BRD and note the highest `BRD-N`. On a Large project the BRD and checklist are the phase's: `appPhase` in `core-config.yaml` names it, phase 1 is `docs/{App}-BRD.md`, phase n is `docs/{App}-Pn-BRD.md`; the highest id is the highest across every phase. No BRD means no amendment: stop and point at day-1. Note whether the checklist exists.
16
16
  2. Sort every point of the change into ADD (a new capability, actor, screen or integration), MODIFY (an existing item whose behaviour changed, mapped to its `BRD-N`), REMOVE (scope dropped, mapped to its `BRD-N`) or ARCH (a new module, flow, package or decision).
17
- 3. Show the change-set as a numbered table (ADD with the next ids, MODIFY as old to new, REMOVE with the reason, ARCH by decision) and wait for "go" or corrections. This is the only question. In YOLO mode apply it without waiting.
17
+ 3. Show the change-set as a numbered table (ADD with the next ids, MODIFY as old to new, REMOVE with the reason, ARCH by decision) and wait for "go" or corrections. **A table, not an essay: no glossary, no verification chapter, no re-argued history.** This is the only question. In YOLO mode apply it without waiting. If a point of the change turns on something only the owner can decide, do not argue it here — write `docs/{App}-Decision-Request.md` per `.tfcore/tasks/_owner-language.md`, render it, and say one line naming the file and how many decisions it holds.
18
18
  4. BRD. ADD: append a ledger item with the next id, its screen, its mockup link and its acceptance line "When <actor> <does what> on <screen>, then <observable result>"; a new screen gets a row in the Screens and flow table and a Planned row in the Development status table. MODIFY: edit the item in place, same id. REMOVE: `~~BRD-N~~ (removed {date}: reason)`, never deleted. If the additions would take a Small project past 50 requirements, raise it to Medium: `bash .tfcore/utils/tf-day1-files.sh {App} --size M` and the Size in every document header. If they would take a Medium project, or one phase, past 100 requirements or 20 screens, stop and propose a phase split: a new row in `docs/{App}-Phases.md` (written with `--size L` when absent) and a new `docs/{App}-Pn-BRD.md`, instead of growing this one.
19
19
  5. Architecture, when in scope and ARCH items exist: edit the affected sections in place, and add a Decisions log row (date, decision, why, status `planned` naming the BRD item) for every new decision or package. A reversed decision gets a new row; the old row stays.
20
20
  6. Mockups: when a screen was added or changed, run `.tfcore/tasks/mockups.md` with `--update`, so every screen in the BRD has a current mockup before the checklist changes.
21
21
  7. Checklist, only if it exists. ADD: `bash .tfcore/utils/tf-split-brd.sh {App} --add-missing` appends rows for the new items; correct their class. MODIFY: set the rows derived from that item to `Needs re-verify` with a Remark saying what changed. REMOVE: set them to `N/A (removed {date})` and keep the rows. Where the mapping from an item to its rows is unclear, ask, do not guess. If the checklist does not exist yet, the next day-1 stage 2 picks everything up.
22
22
  8. If the amendment changed code-level flows, say that `*devguide {App} --update` is due after the next build.
23
- 9. Decide whether this amendment is a miss: should the original documents plainly have said this (a behaviour that was always required, or two sections that contradicted each other)? Then run `*log-miss {App} "<one sentence>"`. A change of mind or a feature decided today is scope arriving late, not a miss.
24
- 10. `bash .tfcore/utils/tf-doc-check.sh --app {App}`; fix every FAIL.
25
- 11. Run the status gate (`.tfcore/tasks/_status-update-gate.md`) with `"cmd":"amend-docs"`.
26
- 12. Report: items added (ids), modified, removed, the highest id now, what changed in the Architecture, the checklist rows touched, and the next command from the gate.
23
+ 9. Close what this amendment fixed: `bash .tfcore/utils/tf-emit.sh --open-misses {App} --artifact-class doc` lists the open misses whose deficient artifact is a document. Close the ones this amendment resolves in one call: `bash .tfcore/utils/tf-fix-close.sh {App} --misses <id>,<id> --fix-cmd amend-docs --verdict Verified`. Where the mapping from a miss to this amendment is unclear, ask, do not guess. Without this a document miss can never close: `*fix-issues` and `*build-phase` close off checklist rows the verifier touched, which a BRD edit never is.
24
+ 10. Decide whether this amendment is a miss: should the original documents plainly have said this (a behaviour that was always required, or two sections that contradicted each other)? Then run `*log-miss {App} "<one sentence>"`. A change of mind or a feature decided today is scope arriving late, not a miss.
25
+ 11. `bash .tfcore/utils/tf-doc-check.sh --app {App}`; fix every FAIL.
26
+ 12. Run the status gate (`.tfcore/tasks/_status-update-gate.md`) with `"cmd":"amend-docs"`.
27
+ 13. Report: items added (ids), modified, removed, the highest id now, what changed in the Architecture, the checklist rows touched, and the next command from the gate.
@@ -10,7 +10,7 @@ First: `bash .tfcore/utils/tf-phase.sh start build-phase {App}` prints the start
10
10
 
11
11
  ## Steps
12
12
 
13
- 1. `bash .tfcore/utils/tf-build-list.sh {App} --prompts` prints the mode, the working list, the clusters and one sub-agent prompt per cluster. FIX means the verifier or a smoke failed rows: build only those. FRESH means every open row. NOTHING means run the status gate and stop. A row without an acceptance line is refused: fix the checklist first, then re-run.
13
+ 1. `bash .tfcore/utils/tf-build-list.sh {App} --prompts` prints the mode, the working list, the clusters and one sub-agent prompt per cluster. The working list is **every** open row in both FIX and FRESH; FIX only means the rows the verifier or a smoke failed come first. NOTHING means run the status gate and stop. A row without an acceptance line is refused: fix the checklist first, then re-run.
14
14
  2. Spawn every cluster in one turn, each with its printed prompt unchanged: `[trblazeui]` clusters through `/trblazeui`, `[techierag]` through `/techierag`, `[builder]` through the harness's builder sub-agent (`tf-builder` when registered, else the general one). Wait for all of them. A cluster that returns `PARTIAL` is re-spawned with its missing rows. Context pressure is a reason to delegate more, never to stop, and a working list is never shortened: "run build-phase again for the rest" is not an ending.
15
15
  3. A row that cannot be built as written (no mockup, two rows that contradict, a behaviour the BRD plainly needed and never named): take the sensible reading, write it in the row's Remarks, keep building, and log the gap as a `miss` (`.tfcore/tasks/_metrics-emit-gate.md`) with `miss_class` `unspecified-gap` or `spec-contradiction`, `artifact` naming the document, `found_by` `agent-review`, `found_phase` `build-phase`. A library gap goes into `docs/{App}-<Library>-Feedback.md` (from `.tfcore/templates/v4custom/app-library-feedback-tmpl.md`, one file per library) and the row becomes `Blocked`; never a workaround.
16
16
  4. `bash .tfcore/utils/tf-build.sh`: PASS, or FAIL with the real errors (fix them, fanning out by file when there are many), or NOT-RUN naming the rungs tried, which is a host problem and never a blocker. `bash .tfcore/utils/tf-build.sh test` runs the tests.
@@ -276,3 +276,7 @@ CRITICAL: collaborate with the user to develop specific, actionable research que
276
276
  - Balance comprehensiveness with focus
277
277
  - Document assumptions and limitations clearly
278
278
  - Plan for iterative refinement based on initial findings
279
+
280
+ ## Record the run
281
+
282
+ First action of this task: `bash .tfcore/utils/tf-phase.sh start create-deep-research-prompt {App}`. Last action: one `runs.jsonl` record carrying `"cmd":"create-deep-research-prompt"`, written as `.tfcore/tasks/_metrics-emit-gate.md` shows. No status gate here — this command advances no phase. Telemetry has no veto: if the write fails, the command still succeeded.
@@ -99,3 +99,7 @@ User can type `#yolo` to toggle to YOLO mode (process all sections at once).
99
99
  - Select options 2-9 from data/elicitation-methods only
100
100
  - Provide detailed rationale explaining decisions
101
101
  - End with "Select 1-9 or just type your question/feedback:"
102
+
103
+ ## Record the run
104
+
105
+ First action of this task: `bash .tfcore/utils/tf-phase.sh start create-doc {App}`. Last action: one `runs.jsonl` record carrying `"cmd":"create-doc"`, written as `.tfcore/tasks/_metrics-emit-gate.md` shows. No status gate here — this command advances no phase. Telemetry has no veto: if the write fails, the command still succeeded.
@@ -0,0 +1,22 @@
1
+ # create-project-brief
2
+
3
+ `*create-project-brief {App}` writes `docs/{App}-Brief.md`, the one page day-1 reads. It is the cheapest place to be wrong, so it is short and the owner corrects it in two minutes.
4
+
5
+ First: `bash .tfcore/utils/tf-phase.sh start create-project-brief {App}` prints the start time and marks the command running.
6
+
7
+ ## Inputs
8
+
9
+ - `{App}`, or read it from `core-config.yaml`.
10
+ - Whatever the owner gives: a paragraph, a brainstorm result (`docs/brainstorming-session-results.md`), a conversation, or nothing.
11
+
12
+ ## Steps
13
+
14
+ 1. Read `.tfcore/templates/v4custom/app-brief-tmpl.md` — its schema block is the required shape.
15
+ 2. Fill the five sections from what the owner gave. Ask only for what you cannot infer, one round of questions, all at once. In YOLO mode take the sensible reading and mark it.
16
+ 3. **A thing you do not know goes in "Open questions", never into a section as a guess.** Day-1 then asks rather than assumes, which is the whole point of writing this before the Architecture exists.
17
+ 4. Every "Must do" line is an outcome a user gets, numbered, one per line. A line needing a paragraph is two lines.
18
+ 5. Write `docs/{App}-Brief.md`. Never a `-v2`; an amended brief is edited in place.
19
+ 6. `bash .tfcore/utils/tf-doc-check.sh docs/{App}-Brief.md`; fix every FAIL.
20
+ 7. Render it: `bash .tfcore/utils/tf-render-html.sh docs/{App}-Brief.md`. The owner reads the HTML.
21
+ 8. Close: one `runs.jsonl` record carrying `"cmd":"create-project-brief"`, written as `.tfcore/tasks/_metrics-emit-gate.md` shows. No status gate — the project has no checklist yet.
22
+ 9. Report in one line: the file, and how many open questions it carries. Then say the next command is `*day1-greenfield {App}` or `*day1-brownfield {App}`.
@@ -8,7 +8,7 @@ First, before anything else: `bash .tfcore/utils/tf-phase.sh start day1-brownfie
8
8
 
9
9
  1. `{App}` if missing. PascalCase, no spaces; reject anything else and ask again.
10
10
  2. Hints, once: list the markdown files found under `docs/` and at the root (excluding `docs/OldDocs/`, `CLAUDE.md`, `PROJECT-STATUS.md`, and `README.md` unless it holds requirements), then ask: "Reply `all` (or press enter) to harvest all of them, or list the ones to use. Add extra paths or drafting instructions in the same reply. `none` harvests nothing." Parse once: file names into the harvest list, anything else into drafting instructions. Never ask merge-or-new.
11
- 3. The stack: "Which answer set: `dotnet` (`.tfcore/templates/stack-defaults/dotnet.md`), or answer the questions in `.tfcore/templates/stack-questions.md`?" Then only the questions the set leaves open, and only where the code does not already answer them.
11
+ 3. The stack: "Which answer set (the files under `.tfcore/templates/stack-defaults/`), or answer the questions in `.tfcore/templates/stack-questions.md`?" Then only the questions the set leaves open, and only where the code does not already answer them.
12
12
  4. The size: count the routed pages in the code (every route counts, sign-in included; dialogs and tabs are regions of a page) and the roles, then confirm: "Size: Small (up to 10 screens, one role, 50 requirements), Medium (up to 20 screens, 100 requirements) or Large (split into phases)? I count {N} screens and {N} roles, so I propose {X}." Kind is `app`, or `library` for a component or service library.
13
13
 
14
14
  ## Steps, in this order
@@ -21,7 +21,7 @@ First, before anything else: `bash .tfcore/utils/tf-phase.sh start day1-brownfie
21
21
  6. BRD, second half: the Requirements ledger, one `BRD-N` per thing the verifier will test, each naming its screen, linking its mockup and carrying one acceptance line "When <actor> <does what> on <screen>, then <observable result>". Harvested documents come first: every "the system shall" or "the user can" line becomes an item, attributed, and every table, screen inventory and workflow they hold carries in, never compressed to a one-liner. Then the code: what it already does becomes items too. Mark inferred items `<!-- inferred — please verify -->`. The Non-functional table takes a `perf-budget:` only where the owner stated a number, and the logging requirement from the answer set, recorded as met when the scan found it wired. The Development status table has one row per screen with Verified and Open counts from the strongest evidence. If the count would pass the size cap, propose a phase split instead of merging items.
22
22
  Large: steps 4 to 6 run once per phase of the Phases table, phase 1 in `docs/{App}-BRD.md` and `docs/{App}-UIDesign.md`, phase n in `docs/{App}-Pn-BRD.md` and `docs/{App}-Pn-UIDesign.md`, each header carrying `Phase | n of m` and its own Size, ids running on across phases.
23
23
  7. Checklist: run `.tfcore/tasks/split-brd.md` for `{App}` (Large: with `--all-phases`, one checklist per phase). If a phased plan is among the harvested documents, split-brd migrates its statuses; the plan then moves to `docs/OldDocs/`.
24
- 8. Coding Standards: `docs/{App}-Coding-Standards.md` from `app-coding-standards-tmpl.md`. "Standards applied" names `.tfcore/standards/coding-standards-core.md` and the stack file, plus the choices the stack file leaves open. For dotnet the instance-field prefix follows the drift scan of step 3: the dominant style if one reaches 80 percent, else `obj`; a drafting instruction overrides. "Project rules" holds only rules true of this project alone.
24
+ 8. Coding Standards: `docs/{App}-Coding-Standards.md` from `app-coding-standards-tmpl.md`. "Standards applied" names `.tfcore/standards/coding-standards-core.md` and the stack file, plus the choices the stack file leaves open. Where the stack file leaves a naming convention open, it follows the drift scan of step 3: the dominant style if one reaches 80 percent, else the stack file's default; a drafting instruction overrides. "Project rules" holds only rules true of this project alone.
25
25
  9. `bash .tfcore/utils/tf-day1-files.sh {App} --prefix {obj|none}` writes `.editorconfig`, `AGENTS.md` and `CLAUDE.md`.
26
26
  10. `bash .tfcore/utils/tf-gitignore-audit.sh . --fix`. Read its output. Any untracking commands it prints go into your summary for the owner to run; agents never run git.
27
27
  11. Build once through `.tfcore/templates/v4custom/build-invocation-ladder.md`. A real compile error becomes one line under Known blockers; a wrong-rung error never does.
@@ -11,7 +11,7 @@ Ask once each, and nothing per section:
11
11
  1. `{App}` if missing. PascalCase, no spaces.
12
12
  2. The concept: "Describe the app, any length: a sentence, paragraphs, bullets, half-baked notes, comparisons to other apps. You will edit the document afterwards." Read all of it. Never cap or summarise the owner's input.
13
13
  3. Hints, optional: paths to notes or mockups to harvest, and drafting instructions. `none` is fine.
14
- 4. The stack: "Which answer set: `dotnet` (`.tfcore/templates/stack-defaults/dotnet.md`), or answer the questions in `.tfcore/templates/stack-questions.md`?" Then ask only the questions the set leaves open (for dotnet: Q4, and the rendering mode of Q8).
14
+ 4. The stack: "Which answer set (the files under `.tfcore/templates/stack-defaults/`), or answer the questions in `.tfcore/templates/stack-questions.md`?" Then ask only the questions that answer set leaves open — each set names its own.
15
15
  5. The size: count the routed pages in the concept (every page with its own route, sign-in included; dialogs and tabs are regions of a page) and the roles, then ask: "Size: Small (up to 10 screens, one role, 50 requirements), Medium (up to 20 screens, 100 requirements) or Large (split into phases)? I count {N} screens and {N} roles, so I propose {X}." Kind is `app` unless the concept is a library.
16
16
 
17
17
  Then, in this order:
@@ -32,7 +32,7 @@ Only with `--stage2`, and only when `docs/{App}-BRD.md` exists. Ask nothing.
32
32
 
33
33
  0. If the owner gave corrections at the review, apply them to the stage-1 documents first (ids never renumbered; `bash .tfcore/utils/tf-doc-check.sh --app {App}` must pass), count them, and after this run's record append a `review` record: `{"kind":"review","phase":"day1-review","reviewed_run_id":"<stage 1 started>","correction_run_id":"<this run's started>","corrections":N,"what":"<one sentence>"}` through `tf-emit.sh misses`.
34
34
  1. Checklist: run `.tfcore/tasks/split-brd.md` for `{App}` (Large: with `--all-phases`, one checklist per phase). The owner never types `*split-brd`.
35
- 2. Coding Standards: `docs/{App}-Coding-Standards.md` from `app-coding-standards-tmpl.md`. "Standards applied" names `.tfcore/standards/coding-standards-core.md` and the stack file, plus the choices the stack file leaves open (for dotnet, the instance-field prefix, default `obj`). "Project rules" stays empty unless the concept demands a rule true of this project alone.
35
+ 2. Coding Standards: `docs/{App}-Coding-Standards.md` from `app-coding-standards-tmpl.md`. "Standards applied" names `.tfcore/standards/coding-standards-core.md` and the stack file, plus the choices the stack file leaves open, taking that file's stated default for each. "Project rules" stays empty unless the concept demands a rule true of this project alone.
36
36
  3. `bash .tfcore/utils/tf-day1-files.sh {App} --prefix {obj|none}` writes `.editorconfig`, `AGENTS.md` and `CLAUDE.md` from their templates.
37
37
  4. UsageGuide: `docs/{App}-UsageGuide.md` from `app-usageguide-tmpl.md`. The Test users table lists the intended accounts, one per role, none created. The Execution guide is at roadmap level, marking commands that depend on projects not yet built. One "How to test" section per screen in navigation order, naming the user, the steps, the expected result and the REQ ids.
38
38
  5. `bash .tfcore/utils/tf-gitignore-audit.sh . --fix`. Read its output. Any untracking commands it prints go into your summary for the owner to run; agents never run git.
@@ -134,3 +134,7 @@ Generate structured document with these sections:
134
134
  - Always ask before switching techniques: "Ready to try a different approach?"
135
135
  - Offer options: "Should we explore this idea deeper or generate more alternatives?"
136
136
  - Respect their process and timing
137
+
138
+ ## Record the run
139
+
140
+ First action of this task: `bash .tfcore/utils/tf-phase.sh start facilitate-brainstorming-session {App}`. Last action: one `runs.jsonl` record carrying `"cmd":"facilitate-brainstorming-session"`, written as `.tfcore/tasks/_metrics-emit-gate.md` shows. No status gate here — this command advances no phase. Telemetry has no veto: if the write fails, the command still succeeded.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Convert one or more **human-readable** markdown files to self-contained HTML using the shared shell. Use this when you need to render documents that `*render-workflow-docs` does not cover (the UsageGuide, the DevGuide, library-feedback docs, ad-hoc design notes, legacy/archived docs). Note: suffixed doc variants like `-v2` are banned by the collision policy (day1-brownfield §1.6) — superseded docs live unmodified in `docs/OldDocs/`.
4
4
 
5
- **NEVER render the checklist to HTML.** The `*-Checklist.md` (and its Requirements Status table) is an **AI-agent working document** — agents read it in markdown. An HTML mirror just burns tokens and drifts from the source. If asked to render a `*-Checklist.md`, decline and explain it's an agent doc; if a stale `*-Checklist.html` exists from before this rule, the user may delete it.
5
+ **NEVER render an agent working document to HTML.** Two are banned by name and `tf-render-html.sh` refuses both with exit 2: the **requirements checklist** `*-Checklist.md` (and its Requirements Status table), and the **miss log** `*-Misses.md`. Agents read them in markdown; an HTML mirror burns tokens and drifts from the source. If asked to render either, decline and explain it is an agent document; if a stale `*-Checklist.html` or `*-Misses.html` exists from before this rule, delete it. The test for any other file: **if the only reader is an agent, it stays markdown.**
6
6
 
7
7
  ## Why this exists
8
8
 
@@ -113,3 +113,7 @@ Print one line per rendered file: the absolute output path. End with: `Open each
113
113
  - [ ] Mermaid validity pass done (shell §5.5): every non-trivial label double-quoted, no `end` node ids, bare labels fixed not emitted
114
114
  - [ ] No agent-facing authoring note (Depth/Mermaid mandate, template how-to) rendered as visible text — leaked ones omitted and reported
115
115
  - [ ] Copy buttons present on every `<pre>` (added by JS, no need to inject manually)
116
+
117
+ ## Record the run
118
+
119
+ First action of this task: `bash .tfcore/utils/tf-phase.sh start generate-html {App}`. Last action: one `runs.jsonl` record carrying `"cmd":"generate-html"`, written as `.tfcore/tasks/_metrics-emit-gate.md` shows. No status gate here — this command advances no phase. Telemetry has no veto: if the write fails, the command still succeeded.
@@ -23,26 +23,28 @@ The Usage Guide was created at day-1 (`day1-*` §7.4) from `.tfcore/templates/v4
23
23
 
24
24
  Below, "populate" means refresh these sections of the existing doc. Hard rules:
25
25
 
26
- - **No narrative prose anywhere.** No "this app uses Blazor Server because…", no caveats, no explanations. The deployment-steps section must look like a runbook — one command per line, numbered in execution order.
26
+ - **No narrative prose anywhere.** No "this app is built this way because…", no caveats, no explanations. The deployment-steps section must look like a runbook — one command per line, numbered in execution order.
27
27
  - **Skip any step that doesn't apply.** If the repo has no SQL migrations, omit the database-setup step entirely — do not leave "N/A" placeholders or "// not applicable" comments.
28
28
  - **No optional steps in the numbered list.** The numbered deployment-steps section is the minimum sufficient set of commands to go from `git clone` to a running app. Anything optional goes in "Known limitations" or a separate doc.
29
29
 
30
30
  Detection sources for each section:
31
31
 
32
- - **Prerequisites**: SDK version from `global.json` / `.csproj` `<TargetFramework>`. Add a one-line entry for each external runtime the build/test commands depend on (Node only if Playwright tests exist; Postgres/SQL Server/etc. only if migrations exist; MAUI workload only if there's a MAUI project). One line each. No prose.
32
+ **Every command below comes from the project, never from this file.** The restore, build, run and test commands are the ones the project's Architecture stack table and `docs/{App}-Coding-Standards.md` name, and `bash .tfcore/utils/tf-build.sh --print` prints the build command this repository actually uses. A toolchain assumed here would be wrong on the next project.
33
+
34
+ - **Prerequisites**: the runtime version from wherever this stack pins it (the Architecture stack table names the file). Then one line for each external runtime the build, run or test commands depend on — a package runtime only if the tests need one, a database server only if migrations exist, a platform workload only if a project targets that platform. One line each. No prose.
33
35
  - **Deployment steps**: detect in this order and emit one numbered step per command:
34
36
  1. `git clone <repo>` (always)
35
- 2. `dotnet restore` (always)
36
- 3. SQL migrations — scan `database/`, `db/migrations/`, `src/*Db/Scripts/`, and any DbUp project's `<EmbeddedResource>` paths. List `.sql` files in lexicographic order, one per line. If a DbUp project exists, prefer `dotnet run --project src/{AppName}.Db` as a single step instead of listing each SQL file.
37
- 4. `dotnet build`
38
- 5. Backend run — find the API/service startup project. One `dotnet run --project ... --urls http://localhost:5100` line.
39
- 6. Frontend run — find the Web/UI startup project. One `dotnet run --project ... --urls http://localhost:5099` line.
40
- 7. "Open http://localhost:5099 in a browser."
41
- - For MAUI: replace step 5/6 with `winrun "dotnet build src/{AppName}.Maui"` then `winrun "dotnet run --project src/{AppName}.Maui"`.
42
- - If frontend and backend are the same project (Blazor Server-only): collapse steps 5+6 into one.
43
- - **Test**: `dotnet test`. Add `npx playwright test` ONLY if the repo has Playwright tests checked in.
37
+ 2. Restore dependencies — the stack's restore command (always)
38
+ 3. Database migrations — scan the migration folders the Architecture names, plus the conventional ones (`database/`, `db/migrations/`, `migrations/`). List the migration files in the order they run, one per line; if the stack has a migration runner, prefer one step invoking it over listing every file.
39
+ 4. Build — the stack's build command
40
+ 5. Backend run — find the service or API entry point. One line, with the port it listens on.
41
+ 6. Frontend run — find the UI entry point. One line, with its port.
42
+ 7. "Open http://localhost:<frontend port> in a browser."
43
+ - A packaged desktop or mobile head replaces steps 5 and 6 with that platform's build-and-run pair.
44
+ - If frontend and backend are one process, collapse steps 5 and 6 into one.
45
+ - **Test**: the stack's test command. Add the browser-test command ONLY if such tests are checked in.
44
46
  - **Smoke checklist**: one checkbox per top-level BRD capability (5–10 max). Each line is a user action, not a technical step ("Log in as admin and load the dashboard" — NOT "verify JWT validation").
45
- - **Known limitations**: pull every `Blocked` REQ row from the checklist Status table + every entry from the per-library feedback files (`docs/{AppName}-TrBlazeUI-Feedback.md`, `docs/{AppName}-TechieRag-Feedback.md`). One line each. Cross-reference to issue IDs (TR-NNN, TR-RAG-NNN).
47
+ - **Known limitations**: pull every `Blocked` REQ row from the checklist Status table + every entry from the per-library feedback files (`docs/{AppName}-{Library}-Feedback.md`, one per library the project uses). One line each. Cross-reference each to its issue id.
46
48
 
47
49
  **If you find yourself writing more than one line per numbered step, you're doing it wrong** — the user has explicitly called out that the deployment steps got polluted with "unnecessary details" in past runs. Strip aggressively.
48
50
 
@@ -50,7 +52,7 @@ Detection sources for each section:
50
52
 
51
53
  - `current_phase: Handoff` (the user manually sets `Released` after UAT passes — §5)
52
54
  - `last_updated`: today
53
- - `last_verified_build: PASS` (you just verified — confirm with `dotnet build` if uncertain)
55
+ - `last_verified_build: PASS` (you just verified — confirm with `bash .tfcore/utils/tf-build.sh` if uncertain)
54
56
  - `last_verified_date`: today
55
57
  - "Where I am": one paragraph — "All REQ-* verified; awaiting UAT per usage doc."
56
58
  - "Next command to run": `Manual UAT per docs/{AppName}-UsageGuide.md smoke checklist.`
@@ -90,7 +92,7 @@ Run `.tfcore/tasks/devguide.md` for `{AppName}` (`*devguide {AppName}`) so the s
90
92
 
91
93
  ### 4. Consolidate the per-library feedback files
92
94
 
93
- For EACH of `docs/{AppName}-TrBlazeUI-Feedback.md` and `docs/{AppName}-TechieRag-Feedback.md` (and any other `docs/{AppName}-{LibName}-Feedback.md`) that exists — they are separate files because each goes to a different team:
95
+ For EACH `docs/{AppName}-{Upstream}-Feedback.md` that exists — one per library the project uses, plus the framework's own — they are separate files because each goes to a different team:
94
96
  - Deduplicate entries (same expected/actual pair = duplicate; merge them).
95
97
  - Sort by severity: blocker → major → minor → nice-to-have.
96
98
  - Ensure each entry has all the schema fields (Severity, Repro, Expected, Actual, Encountered in, Workaround, Suggested fix). Fill in missing ones from context if possible.
@@ -108,11 +110,11 @@ If no feedback file exists (no library issues encountered), skip this step.
108
110
 
109
111
  Deliver:
110
112
  - "✔ {AppName} is ready for UAT." OR
111
- - "⚠ {AppName} has {N} `Blocked` (library-gap) items — see docs/{AppName}-TrBlazeUI-Feedback.md / docs/{AppName}-TechieRag-Feedback.md before UAT."
113
+ - "⚠ {AppName} has {N} `Blocked` (library-gap) items — see the `docs/{AppName}-{Upstream}-Feedback.md` files before UAT."
112
114
 
113
115
  Then explicitly tell the user:
114
116
  1. Open `docs/{AppName}-UsageGuide.md` and run the smoke checklist.
115
- 2. Hand each per-library feedback file to its team (or file as GitHub issues against that library's repo): `docs/{AppName}-TrBlazeUI-Feedback.md` → TrBlazeUI team, `docs/{AppName}-TechieRag-Feedback.md` → TechieRag team. The library teams use this same framework, so the file drops straight into their flow.
117
+ 2. Hand each feedback file to the team named in its file name (or file its entries as issues against that repository). Those teams use this same framework, so the file drops straight into their flow.
116
118
  3. After UAT passes, manually update `PROJECT-STATUS.md`: `current_phase: Released`.
117
119
  4. For end-user / external documentation, run `*productguide {AppName}` (flow-master) — it builds a screenshot-illustrated, task-oriented user manual (MD + HTML) from the DevGuide's screen map + captured screenshots. On-demand; re-run with `--update` as the UI evolves.
118
120
 
@@ -108,6 +108,8 @@ Written: docs/metrics/METRICS.md + .html
108
108
  {if backfilled records present: "Backfilled data is reported in a separate column and cannot support a published first-pass rate."}
109
109
  ```
110
110
 
111
+ Then one `runs.jsonl` record carrying `"cmd":"metrics-report"`, written as `.tfcore/tasks/_metrics-emit-gate.md` shows; `bash .tfcore/utils/tf-phase.sh start metrics-report {App}` is the first action of this task, so the start time is measured.
112
+
111
113
  Then stop. Do not run the status gate — this task reports on history, it does not advance the project, and PROJECT-STATUS is not where metrics go.
112
114
 
113
115
  ## Hard rules
@@ -28,7 +28,7 @@ The phase's checklist, UIDesign and `docs/mockups/` (`appPhase` in `core-config.
28
28
 
29
29
  1. `bash .tfcore/utils/tf-verify-list.sh {App} {scope}` prints the rows to grade with their acceptance line, screen, route, mockup and perf budget, the screens to drive, and the test users; it writes `tests/.artifacts/verify/list.json`. Every row in scope is graded whatever its status; only N/A is skipped, so a `Verified` row is re-confirmed and an old `Done` claim is tested. NOTHING means run the status gate and stop. A row without an acceptance line cannot be graded: fix the checklist first. A dialog is listed under its parent screen and checked there; never give a dialog a route so it can be tested.
30
30
  2. `bash .tfcore/utils/tf-verify-env.sh` prints READY, or the one command the owner must run once.
31
- 3. `bash .tfcore/utils/tf-verify-boot.sh start` boots the head it finds (`--head` or `--project` when there are several) and prints BOOTED with a URL, or a CDP URL for a Blazor Hybrid Windows head, which the browser tools attach to. A dependent service (database, API) is yours to start first, from its own configuration, in order. NONE `kind=build-error`: every row fails the build check; go to step 6. NONE `kind=host` or `kind=no-driver` (an Android, iOS or Mac head): go to step 6 as well; those rows are written "not verified" with the reason. Never a static-only pass, never "the owner should start it".
31
+ 3. `bash .tfcore/utils/tf-verify-boot.sh start` boots the head it finds (`--head` or `--project` when there are several) and prints BOOTED with a URL, or a CDP URL for an embedded-browser desktop head, which the browser tools attach to. A dependent service (database, API) is yours to start first, from its own configuration, in order. NONE `kind=build-error`: every row fails the build check; go to step 6. NONE `kind=host` or `kind=no-driver` (an Android, iOS or Mac head): go to step 6 as well; those rows are written "not verified" with the reason. Never a static-only pass, never "the owner should start it".
32
32
  4. Tests. Every UI and functional row has one test whose title starts with its id, written from the acceptance line, black box, under `tests/verify/`; an NFR row without a screen has a unit test carrying its id in the test project, or is not observable. Reuse a test that exists. Fan out one test-writer sub-agent per screen group in one turn, each with its rows, their acceptance lines, the URL and the test user; a test writer touches no source. Sign in as a UsageGuide test user (`.tfcore/tasks/_smoke-test-policy.md`).
33
33
  5. Run the checks, with `<url>` from step 3 and, on a signed-in app, the session cookie from the test login for the tools that take `--cookie`:
34
34
  - `bash .tfcore/utils/tf-verify-tests.sh --base <url>`
@@ -127,6 +127,34 @@ So `tf-emit.sh` detects it and injects it. **Never write `harness` into an emit
127
127
 
128
128
  Provenance rule applied once more: **never pool `cost_usd` across harness** — Claude records are `null`, and a sum over mixed records silently under-reports. Tokens may be compared across harness; dollars may not.
129
129
 
130
+ ### 2.5b How the model was paid for (added 2026-09-10; injected by `tf-emit.sh`, never emitted by an agent)
131
+
132
+ `cost_usd` alone answers *how much* and never *of what*, and on one machine it is three different quantities at once. The owner found this on 2026-09-10 (MISS-TechieFlow-20260910-02): a `runs.jsonl` here holds OpenCode records on a metered API key where the dollars are real money, OpenCode records on an OAuth subscription where OpenCode records **0.0** because the plan was already paid for, OpenCode records on a model running on this machine where there is no bill at all, and Claude Code records that are permanently `null`. Summing them produces a number that is neither the money spent nor the effort used, and the two zeroes are indistinguishable from a free run.
133
+
134
+ | Field | Type | Meaning / source |
135
+ |---|---|---|
136
+ | `billing_mode` | string | `subscription` \| `metered` \| `local` \| `mixed` \| `unknown`. Resolved per observed model by `bash .tfcore/utils/tf-model-pick.sh billing <model> <harness>`: OpenCode's own `auth.json` says `oauth` (a plan) or `api` (a key), a provider that runs on this machine is `local`, a provider with no credential is `unknown` and is never assumed to be billable, and `routing.yaml` `billing:` overrides any of it by name. Claude Code is **declared** in `billing.claude` (default `subscription`), because nothing in a transcript says which plan paid for it. `mixed` when one window ran models of more than one mode — which is exactly what a fallback from a subscription to a metered key looks like. |
137
+ | `cost_source` | string | `opencode-db` where a per-message cost was read, `none` where there is no cost source at all. **Never a rate card.** |
138
+
139
+ `billing_mode` has five values, and the `plan` one is the reason the field is not a boolean:
140
+
141
+ | Value | What the provider's cost number is |
142
+ |---|---|
143
+ | `subscription` | Nothing, or a recorded `0.0`. A flat fee bought the quota before the run started. |
144
+ | `plan` | **Allowance consumed against a per-model limit, not an invoice.** OpenCode Go is $10/month with a $15–$60 monthly allowance *per model* and 5-hour / weekly / monthly thresholds (<https://opencode.ai/docs/go>), so its dollars are a meter — and they are precisely the numbers that produce the limit `routing.yaml` `fallbacks:` exists for. Detected from the provider name, because an API key alone cannot tell a plan from a per-token bill. |
145
+ | `metered` | Money actually billed, per token. |
146
+ | `local` | No bill at all. |
147
+ | `mixed` / `unknown` | Several modes in one window; or nothing here could tell. `unknown` is never quietly treated as billable. |
148
+
149
+ **Money is never computed into a record.** Tokens are what the framework measures and stores — per model, main thread and sub-agents apart (§2.5, §2.6) — and turning them into a price is a *reporting* job, done by `tf-metrics.sh` (and by any other reader, TfLens included) from the fields already on the stream. That is §8's existing rule, *derived metrics are computed, never stored*, applied to money; it is why a rate card can change, or a reader disagree with this one, without a single record becoming wrong, and why every run ever recorded is re-priced the moment the rate card is corrected. The shared rate lookup is `bash .tfcore/utils/tf-model-pick.sh rate <model>`, which reads the models.dev catalog and lets a project's own `.tfcore/rate-card.json` win.
150
+
151
+ Two simplifications in that price, stated rather than hidden: the **base** rate is used, so a provider's long-context surcharge is not applied (nothing records per-message context length, and guessing it would be worse than the small understatement); and a model the rate card does not carry produces no number rather than a zero.
152
+ | `fallback_from` | string | **`runs`/`gates` only.** The tier's own model, named here when the run started while that model was on cooldown for a usage limit. It is what separates *"routing drifted"* from *"the tier model was out of quota and the chain moved on"* — both of which set `routed:false`, and only one of which is a problem. |
153
+
154
+ **The reporting rule, enforced in `tf-metrics.sh` and not merely stated here:** the report carries **three** money lines and never merges them — *list price*, computed over every record that can be priced and labelled a price rather than a bill; *plan allowance used*, per model, over `billing_mode:"plan"` records, because that is the meter a per-model limit is read against; and *money billed*, over `billing_mode:"metered"` records only. Each prints what it excluded. A window whose models were paid for in different ways contributes real money that cannot be separated from the part a subscription had already covered, so it gets its own line rather than being folded into any of the three. Per-model spend is attributed only where the window ran a single model; splitting one window's dollars across several models by token share is arithmetic, not measurement — the same line §5.5.3 draws between `sole` and `shared`. A record written before 2026-09-10 carries no `billing_mode`; it is admitted on its old terms and counted separately, so this change does not silently rewrite the past.
155
+
156
+ Tokens remain the unit that works everywhere, and they are what every figure is built from. `cost_usd` is whatever the provider itself reported, and `billing_mode` is what stops a reader mistaking a meter, a flat fee and an invoice for one another.
157
+
130
158
  ### 2.6 Per-phase effort fields (added 2026-08-31; injected by `tf-emit.sh`, never emitted by an agent)
131
159
 
132
160
  Added so the question *"what did each phase cost — in time, in tokens, on which model, with how much fan-out?"* is answerable from the streams rather than reconstructed by hand. §2 and §2.5 already carried `cmd`, `started`/`ended`/`duration_s`, the four token counters, `model`, `harness`, `tier`/`tier_model`/`routed` and `attempt`. Three things were missing, and each was missing for the same reason: it was either **self-reported** or **not represented at all**.
@@ -147,6 +175,34 @@ Added so the question *"what did each phase cost — in time, in tokens, on whic
147
175
 
148
176
  **These do not create per-feature timing.** The unit stays **the run**; §0's non-goal is unchanged. `cmd` is the phase, and a phase figure is an aggregate over runs of that `cmd` — never a per-ticket cycle time.
149
177
 
178
+ ### 2.7 `kind: "run-void"` — taking a wrong run out of the figures without deleting it (added 2026-09-09)
179
+
180
+ The stream is append-only, so a run record that turns out to be **wrong** can be neither edited nor deleted — and nothing inside such a record says it is wrong, so every figure built over it is quietly polluted. §5.5.7 solved the same problem on the misses stream by adding a record kind rather than an edit. This is that answer for runs.
181
+
182
+ A `run-void` names one run record and says why it should not be counted:
183
+
184
+ | Field | Type | Meaning |
185
+ |---|---|---|
186
+ | `kind` | `"run-void"` | the record kind |
187
+ | `app` | string | filled by the emitter from the run it names |
188
+ | `cmd` | string | the named run's `cmd` |
189
+ | `started` | ISO-8601 | the named run's `started` — `cmd` + `started` is the pair the readers already key on |
190
+ | `reason` | string | free text, required: why the record is wrong, in a sentence a reader can check |
191
+
192
+ **Written only by `bash .tfcore/utils/tf-emit.sh --void-run <cmd> <started> "<reason>"`**, which refuses one that names no run on the stream (a void about nothing is a claim about nothing) and refuses a second void on the same run. Like an amend, it exits 0 either way: telemetry has no veto (§10).
193
+
194
+ **What the readers must do, and `tf-metrics.sh` does:** the named record leaves **every** figure — it is never clamped, halved or guessed at — and the count of what left travels with the figures, as `runs_voided_n` with the reasons in `runs_voided`. A total offered without its exclusions is just a different wrong number (the §5.5.8 rule, one stream over). A void naming a run that is not on this stream is an **orphan**: counted as `run_voids_orphaned_n` and reported, never silently dropped, exactly as an orphaned `miss-amend` is.
195
+
196
+ **What it is not.** It is not a delete and not an edit: both records stay, in order, and a reader can always see what was corrected and why. It cannot be used to remove a run whose figures are merely unflattering — the reason is on the record and a reader can check it, which is the whole protection. It is not a way to fix a number: there is no "corrected duration" field, because a figure nobody measured is not recoverable by asserting one.
197
+
198
+ ### 2.7b A run may not start before the last one ended (added 2026-09-10)
199
+
200
+ §2.7 gave a way to **correct** a start time nobody measured, and nothing refused one — so the same mistake was made twice more on the day the correction shipped, each record beginning before the record before it ended, each quietly adding its overlap to every total that crossed it (MISS-TechieFlow-20260910-04, sorted `ignored`: it was written down and not followed). A correction mechanism with no refusal in front of it is a fix that has to be remembered, which is the definition of a rule that rots.
201
+
202
+ `tf-emit.sh` now **refuses** a live `run` record for an app whose `started` precedes the latest `ended` of that app's live runs. The refusal names the record it collides with and the timestamp to use instead; nothing is appended. **Voided and backfilled records are excluded from the comparison**, which is what keeps the §2.7 repair path working: void the wrong record, then the corrected one is accepted.
203
+
204
+ The one real overlap is two machines appending to the same `merge=union` stream (§6). That is declared, with `bash .tfcore/utils/tf-emit.sh runs --allow-overlap`, and never assumed — the mistake this refuses is easy to make and impossible to see afterwards, so the door is a flag rather than a fallback. FR-72; `bash tests/regression/run.sh tf_overlap`.
205
+
150
206
  ## 3. `docs/metrics/gates.jsonl` — one record per REQ verdict per verify run
151
207
 
152
208
  **This is the primary stream.** If only one stream survives, it is this one.
@@ -298,7 +354,7 @@ Written by `.tfcore/hooks/metrics-session.sh`, wired to the **`SessionEnd`** hoo
298
354
  | `cache_creation_tokens` | int | Σ `usage.cache_creation_input_tokens`. |
299
355
  | `cost_usd` | number \| null | **Almost always `null`.** See the limitation below. |
300
356
 
301
- **Known limitation — cost is not in the transcript.** Claude Code `2.x` transcripts carry token counts but no per-message dollar cost, and this framework runs on a Claude Max subscription where marginal per-token cost is not the real unit anyway. `cost_usd` is therefore emitted as `null` and *never* computed from a rate card — that would be an estimate presented as a measurement. Consequently **"cost per verified REQ" is reported in tokens, not dollars**, unless a real cost source appears. (OpenCode's `opencode stats` *does* report real cost — that is the one thing it can measure which Claude Code cannot. Wiring it in is the obvious way this field stops being `null`.)
357
+ **Known limitation — cost is not in the transcript.** Claude Code `2.x` transcripts carry token counts but no per-message dollar cost, and this framework runs on a Claude Max subscription where marginal per-token cost is not the real unit anyway. `cost_usd` is therefore emitted as `null` and *never* computed from a rate card — that would be an estimate presented as a measurement. (Since 2026-09-10 the report does price a run from a rate card, at read time and never into a record; §2.5b is what keeps the two apart.) Consequently **"cost per verified REQ" is reported in tokens, not dollars**, unless a real cost source appears. (OpenCode's `opencode stats` *does* report real cost — that is the one thing it can measure which Claude Code cannot. Wiring it in is the obvious way this field stops being `null`.) **A caveat added 2026-09-10:** OpenCode's cost is real only where the provider is billed per token. On a provider signed in with OAuth it records `0.0`, which is true of the marginal cost and false of the money, so a session record's cost carries the same warning as a run record's — with the difference that `sessions.jsonl` has no `billing_mode` field, because it is not joinable to `runs.jsonl` on anything but time (§4, below) and would have no report to serve. Read session dollars per provider or not at all.
302
358
 
303
359
  **Known limitation — session ≠ run.** One session may span several commands, or one command several sessions. `sessions.jsonl` is **not** joinable to `runs.jsonl` on anything but time. Do not attribute a session's tokens to a single run.
304
360