@hassangameryt/freeflow 0.1.0 → 0.2.0

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 (89) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +8 -4
  3. package/package.json +15 -2
  4. package/plugins/freeflow/.claude-plugin/plugin.json +1 -1
  5. package/plugins/freeflow/.codex-plugin/plugin.json +1 -1
  6. package/plugins/freeflow/command-surface.json +2 -10
  7. package/plugins/freeflow/docs/README.md +3 -2
  8. package/plugins/freeflow/docs/adr/0002-evals-before-hooks.md +1 -1
  9. package/plugins/freeflow/docs/adr/0003-release-boundary.md +1 -1
  10. package/plugins/freeflow/docs/adr/0004-research-replaces-shallow-discovery-skills.md +26 -0
  11. package/plugins/freeflow/docs/adr/README.md +2 -1
  12. package/plugins/freeflow/docs/architecture.md +3 -3
  13. package/plugins/freeflow/docs/output-router.md +212 -0
  14. package/plugins/freeflow/docs/release-evidence.md +25 -5
  15. package/plugins/freeflow/docs/skills.md +6 -7
  16. package/plugins/freeflow/docs/workflow.md +1 -1
  17. package/plugins/freeflow/hooks/freeflow-runtime-context.mjs +23 -6
  18. package/plugins/freeflow/pi-extension/index.js +941 -15
  19. package/plugins/freeflow/router/dist/benchmark-harness.d.ts +32 -0
  20. package/plugins/freeflow/router/dist/benchmark-harness.js +92 -0
  21. package/plugins/freeflow/router/dist/benchmarks.d.ts +102 -0
  22. package/plugins/freeflow/router/dist/benchmarks.js +880 -0
  23. package/plugins/freeflow/router/dist/bounded-evidence.d.ts +40 -0
  24. package/plugins/freeflow/router/dist/bounded-evidence.js +310 -0
  25. package/plugins/freeflow/router/dist/codex-qa-benchmarks.d.ts +91 -0
  26. package/plugins/freeflow/router/dist/codex-qa-benchmarks.js +461 -0
  27. package/plugins/freeflow/router/dist/command-benchmarks.d.ts +128 -0
  28. package/plugins/freeflow/router/dist/command-benchmarks.js +652 -0
  29. package/plugins/freeflow/router/dist/config.d.ts +22 -0
  30. package/plugins/freeflow/router/dist/config.js +114 -0
  31. package/plugins/freeflow/router/dist/evidence-range-selector.d.ts +22 -0
  32. package/plugins/freeflow/router/dist/evidence-range-selector.js +180 -0
  33. package/plugins/freeflow/router/dist/evidence-search.d.ts +25 -0
  34. package/plugins/freeflow/router/dist/evidence-search.js +450 -0
  35. package/plugins/freeflow/router/dist/evidence.d.ts +38 -0
  36. package/plugins/freeflow/router/dist/evidence.js +196 -0
  37. package/plugins/freeflow/router/dist/experimental-local-index.d.ts +1 -0
  38. package/plugins/freeflow/router/dist/experimental-local-index.js +1 -0
  39. package/plugins/freeflow/router/dist/experiments/local-index.d.ts +58 -0
  40. package/plugins/freeflow/router/dist/experiments/local-index.js +562 -0
  41. package/plugins/freeflow/router/dist/index-benchmarks.d.ts +84 -0
  42. package/plugins/freeflow/router/dist/index-benchmarks.js +458 -0
  43. package/plugins/freeflow/router/dist/index.d.ts +12 -0
  44. package/plugins/freeflow/router/dist/index.js +12 -0
  45. package/plugins/freeflow/router/dist/line-ranges.d.ts +22 -0
  46. package/plugins/freeflow/router/dist/line-ranges.js +22 -0
  47. package/plugins/freeflow/router/dist/parsers.d.ts +16 -0
  48. package/plugins/freeflow/router/dist/parsers.js +473 -0
  49. package/plugins/freeflow/router/dist/repo-traversal.d.ts +18 -0
  50. package/plugins/freeflow/router/dist/repo-traversal.js +242 -0
  51. package/plugins/freeflow/router/dist/retrieve.d.ts +33 -0
  52. package/plugins/freeflow/router/dist/retrieve.js +855 -0
  53. package/plugins/freeflow/router/dist/router-contract.d.ts +10 -0
  54. package/plugins/freeflow/router/dist/router-contract.js +54 -0
  55. package/plugins/freeflow/router/dist/run.d.ts +26 -0
  56. package/plugins/freeflow/router/dist/run.js +356 -0
  57. package/plugins/freeflow/router/dist/schema.d.ts +18 -0
  58. package/plugins/freeflow/router/dist/schema.js +354 -0
  59. package/plugins/freeflow/router/dist/types.d.ts +234 -0
  60. package/plugins/freeflow/router/dist/types.js +9 -0
  61. package/plugins/freeflow/router/dist/vault.d.ts +80 -0
  62. package/plugins/freeflow/router/dist/vault.js +484 -0
  63. package/plugins/freeflow/skills/commit-work/SKILL.md +17 -16
  64. package/plugins/freeflow/skills/commit-work/references/staging-decisions.md +3 -3
  65. package/plugins/freeflow/skills/execute-plan/SKILL.md +70 -5
  66. package/plugins/freeflow/skills/execute-plan/references/execution-map.md +122 -0
  67. package/plugins/freeflow/skills/mode-contract/SKILL.md +1 -1
  68. package/plugins/freeflow/skills/output-router/SKILL.md +69 -0
  69. package/plugins/freeflow/skills/output-router/references/safety-policy.md +33 -0
  70. package/plugins/freeflow/skills/research/ARTIFACT-DESTINATIONS.md +58 -0
  71. package/plugins/freeflow/skills/research/CHECKPOINTS.md +74 -0
  72. package/plugins/freeflow/skills/research/LANGUAGE.md +61 -0
  73. package/plugins/freeflow/skills/research/SKILL.md +128 -0
  74. package/plugins/freeflow/skills/review-artifact/SKILL.md +34 -1
  75. package/plugins/freeflow/skills/review-artifact/references/reviewer-prompt.md +12 -1
  76. package/plugins/freeflow/skills/review-work/SKILL.md +25 -2
  77. package/plugins/freeflow/skills/review-work/references/reviewer-prompt.md +8 -0
  78. package/plugins/freeflow/skills/setup-freeflow/SKILL.md +14 -4
  79. package/plugins/freeflow/skills/setup-freeflow/references/activation-contract.md +8 -3
  80. package/plugins/freeflow/skills/setup-freeflow/references/host-setup.md +3 -1
  81. package/plugins/freeflow/skills/setup-freeflow/references/output-router-setup.md +52 -0
  82. package/plugins/freeflow/skills/workflow/SKILL.md +11 -3
  83. package/plugins/freeflow/skills/workflow/references/workflow-map.md +10 -11
  84. package/plugins/freeflow/skills/write-skill/SKILL.md +1 -1
  85. package/plugins/freeflow/skills/capture-decisions/SKILL.md +0 -95
  86. package/plugins/freeflow/skills/capture-decisions/references/destination-guide.md +0 -65
  87. package/plugins/freeflow/skills/grill-context/SKILL.md +0 -79
  88. package/plugins/freeflow/skills/grill-context/references/approach-framing.md +0 -52
  89. package/plugins/freeflow/skills/research-brief/SKILL.md +0 -69
@@ -1,21 +1,29 @@
1
1
  ---
2
2
  name: execute-plan
3
- description: Use when implementing an approved plan or executing planned work against a repo, especially when a planned verification command fails or reveals a plan/source conflict. Use when the user says to execute, implement, follow, or carry out a plan.
3
+ description: Use when implementing an approved plan, executing planned slices, resuming planned work, handling planned verification failures, adjudicating review findings during execution, or encountering scope/source conflicts while carrying out a plan.
4
4
  ---
5
5
 
6
6
  # Execute Plan
7
7
 
8
8
  Execute the plan. Do not improve it silently.
9
9
 
10
- Classify first:
10
+ The plan is instructions, not authority. Live repo evidence and source truth win.
11
+
12
+ Move one verified slice at a time. Preserve rollback, reviewability, and user control.
13
+
14
+ Read `references/execution-map.md` when the plan has multiple slices, TDD/benchmark work, review checkpoints, per-slice commits, context-window pressure, or any failed check/review/source-scope conflict.
15
+
16
+ Keep research language alive. Read `../research/LANGUAGE.md` when a slice changes modules, interfaces, seams, adapters, architecture, or when review findings become a stream of edge-case patches. Ask whether the slice is deepening the module or spreading complexity across callers, tests, docs, or review comments.
17
+
18
+ ## Classify First
11
19
 
12
20
  - Valid plan: inspect source context, execute the next slice, verify it.
13
21
  - Plan/source conflict: stop and ask which source should change.
14
22
  - Hidden owner decision: stop and ask.
15
23
  - Missing verification: stop before consequential edits and ask to revise the plan or approve a diagnostic path.
16
24
  - Missing plan: ask for a plan or route to `write-plan`.
17
-
18
- The plan is instructions, not authority.
25
+ - Scope expansion: stop before absorbing it; route back to research, spec, or plan.
26
+ - Review failure during execution: classify findings and report the route before editing from them.
19
27
 
20
28
  ## Before Editing
21
29
 
@@ -28,6 +36,21 @@ Read:
28
36
 
29
37
  Live repo evidence overrides stale plans and handoffs.
30
38
 
39
+ Before each non-trivial slice, name the slice contract:
40
+
41
+ ```text
42
+ Slice:
43
+ Source truth:
44
+ Module/interface changed:
45
+ Behavior/test/benchmark:
46
+ Verification:
47
+ Review checkpoint:
48
+ Commit or handoff checkpoint:
49
+ Stop conditions:
50
+ ```
51
+
52
+ Do not start a slice if the remaining context is not enough to orient, edit, verify, and checkpoint it. Stop with a handoff route instead.
53
+
31
54
  Do not execute a plan that would:
32
55
 
33
56
  - Invent or change product behavior, scope, domain meaning, compatibility, public API behavior, security, privacy, billing, data-loss, or architecture.
@@ -42,26 +65,68 @@ For source-truth conflicts or missing verification, the final line must be a dir
42
65
 
43
66
  For missing verification, ask whether to revise the plan to add a check or approve a specific verification path.
44
67
 
45
- ## Execute
68
+ ## Slice Execution
46
69
 
47
70
  Work in vertical slices.
48
71
 
49
72
  For each slice:
50
73
 
51
74
  - Make only the edits needed for that slice.
75
+ - Keep the slice boundary intact; do not blend future slices into the current one for convenience.
52
76
  - Run the planned check or the smallest equivalent check.
53
77
  - If the check fails, stop and report the evidence before changing direction.
54
78
  - If new evidence invalidates the plan, stop before patching forward.
55
79
 
80
+ When TDD is requested by the user, plan, or repo practice, use TDD inside the slice:
81
+
82
+ ```text
83
+ one behavior test or benchmark
84
+ -> minimal implementation
85
+ -> refactor while green
86
+ -> verify the slice
87
+ ```
88
+
89
+ Do not write all tests first and all implementation later. Do not anticipate future slices.
90
+
56
91
  After a planned verification command fails, do not edit the verifier, tests, docs, policy, source-truth files, or unrelated code to make it pass. This is true even when the verifier appears wrong and even when the user said to "fix whatever is needed". A bad verifier is a plan defect; stop, report the failing command and conflicting evidence, and ask whether to revise the plan or change the source truth.
57
92
 
58
93
  Local reversible implementation details can be chosen from repo conventions.
59
94
 
95
+ If per-slice commits are requested, do not continue to the next slice with a verified slice still uncommitted. Route to `commit-work` after review/verification evidence exists.
96
+
97
+ ## Review Checkpoints
98
+
99
+ Use review where the plan, risk, or slice boundary calls for it. Do not review every slice by habit.
100
+
101
+ A non-passing review is a phase exit, not an autonomous patch loop.
102
+
103
+ When a review returns findings during execution:
104
+
105
+ 1. Inspect the relevant code, tests, docs, plan, and source truth.
106
+ 2. Classify each material finding: accepted, rejected, question, or needs evidence.
107
+ 3. Report the route before editing from that review batch.
108
+
109
+ The turn that receives a non-passing review ends with adjudication and route only. Do not edit from that review batch in the same turn, even when the user or reviewer says to apply all findings and continue reviewing.
110
+
111
+ Do not immediately apply findings and request another review in the same loop. Do not treat non-blocking findings or reviewer questions as automatic failure.
112
+
113
+ If all accepted findings are small, in-scope, and supported by source truth, recommend a bounded fix pass as the next route. Do not perform that fix pass until the user or parent explicitly chooses it after seeing the adjudication. If findings change scope, behavior, source truth, public API, security, privacy, billing, data loss, compatibility, or architecture, route backward before editing.
114
+
115
+ Three review passes is the hard cap for the same slice/work scope. At pass 3, stop, classify, and diagnose. Do not request a fourth broad review. Use a `diagnose-failure`-style loop to decide whether the issue is shallow research, weak spec, wrong plan slice, ambiguous policy, source-truth conflict, shallow module/interface, implementation bug, or stale reviewer context.
116
+
117
+ ## Backward Edge
118
+
119
+ If implementation reveals that the plan is wrong, incomplete, or too narrow, re-enter research/spec/plan before continuing.
120
+
121
+ Do not absorb material scope expansion into execution. New behavior, API shape, security/privacy/billing/data-loss decisions, compatibility changes, or irreversible architecture usually need a revised spec or plan.
122
+
60
123
  ## Completion
61
124
 
62
125
  Report:
63
126
 
64
127
  - What changed.
65
128
  - What was verified.
129
+ - Review status and any adjudicated findings.
130
+ - Commit or handoff status when relevant.
66
131
  - What remains unverified.
67
132
  - Any blocked decisions or plan changes needed.
@@ -0,0 +1,122 @@
1
+ # Execute Plan Map
2
+
3
+ Use this when carrying out a multi-slice plan, resuming from handoff, combining TDD with execution, deciding whether to review/commit, or handling failed checks/reviews/scope changes.
4
+
5
+ The map is a control surface, not ceremony. Small reversible slices can use the compact map only.
6
+
7
+ ## Compact Map
8
+
9
+ ```text
10
+ Orient
11
+ -> Slice contract
12
+ -> Red / Green / Refactor when TDD applies
13
+ -> Verify
14
+ -> Review checkpoint when needed
15
+ -> Commit or handoff checkpoint when needed
16
+ -> Next slice
17
+
18
+ Any failed check, non-pass review, source conflict, or scope expansion
19
+ -> Classify evidence
20
+ -> Report route
21
+ -> Fix | Diagnose | Research | Spec | Plan | Stop
22
+ ```
23
+
24
+ ## Contract Map
25
+
26
+ Before a non-trivial slice, name:
27
+
28
+ ```text
29
+ Slice: what part of the plan is active
30
+ Source truth: spec/docs/tests/policies/code that own behavior
31
+ Module/interface changed: outside contract affected by this slice
32
+ Behavior/test/benchmark: observable behavior to prove
33
+ Verification: command or check that proves this slice
34
+ Review checkpoint: none | after this slice | after stack | final
35
+ Commit or handoff checkpoint: when rollback/resume needs a snapshot
36
+ Stop conditions: decisions/conflicts/failures that end the slice
37
+ ```
38
+
39
+ A slice contract prevents hidden broadening. If the contract changes materially, stop and route backward.
40
+
41
+ ## Reference Map
42
+
43
+ ```mermaid
44
+ flowchart TD
45
+ Start([Plan or handoff]) --> Orient[Orient<br/>read plan, source truth, live code]
46
+ Orient --> Contract[Slice contract<br/>boundary + interface + checks]
47
+ Contract --> Decision{Can execute safely?}
48
+
49
+ Decision -->|yes| Build[Build slice<br/>TDD vertical loop if applicable]
50
+ Decision -->|missing plan/check/decision| Back[Backward route<br/>research / spec / plan / owner]
51
+
52
+ Build --> Verify[Verify planned check]
53
+ Verify -->|pass| ReviewGate{Review needed now?}
54
+ Verify -->|fail| Fail[Classify failure evidence]
55
+
56
+ ReviewGate -->|no| Checkpoint[Commit/handoff checkpoint if needed]
57
+ ReviewGate -->|yes| Review[Review checkpoint]
58
+ Review -->|pass| Checkpoint
59
+ Review -->|non-pass| ReviewFail[Classify findings<br/>accepted / rejected / question / needs evidence]
60
+
61
+ Checkpoint --> Next{Next slice?}
62
+ Next -->|yes| Orient
63
+ Next -->|no| Done([Complete / final verify / handoff])
64
+
65
+ Fail --> Route{Route}
66
+ ReviewFail --> Route
67
+ Route -->|next bounded fix| Build
68
+ Route -->|unclear or repeated| Diagnose[Diagnose]
69
+ Route -->|source/scope decision| Back
70
+ Diagnose --> Back
71
+ ```
72
+
73
+ ## Entry Points
74
+
75
+ Use this map when the current task is:
76
+
77
+ - start or continue an approved plan;
78
+ - execute the next planned slice;
79
+ - resume from a handoff;
80
+ - run a TDD or benchmark-backed implementation slice;
81
+ - handle a planned verification failure;
82
+ - handle review findings during execution;
83
+ - decide whether to commit after a slice;
84
+ - context is getting low before the next slice;
85
+ - implementation reveals scope or source truth changed.
86
+
87
+ ## Exits
88
+
89
+ - **Forward** — slice verified; next slice boundary is clear.
90
+ - **Bounded fix** — accepted finding/check failure is small, in-scope, and source-truth-supported.
91
+ - **Commit checkpoint** — verified slice should be committed before continuing.
92
+ - **Handoff checkpoint** — context is too low or continuation state must survive.
93
+ - **Backward** — scope/source truth/review evidence invalidates the plan.
94
+ - **Diagnose** — repeated failure or edge-case patching suggests a deeper problem.
95
+ - **Stop** — blocked on owner decision or plan/spec/source change.
96
+
97
+ ## Review Failure Routing
98
+
99
+ A non-pass review is not an edit script.
100
+
101
+ Classify before action:
102
+
103
+ - **Accepted** — valid, source-truth-supported, and in scope.
104
+ - **Rejected** — stale, unsupported, already resolved, equivalent, or not important.
105
+ - **Question** — needs owner/product/domain/security/API/etc. decision.
106
+ - **Needs evidence** — inspect before deciding.
107
+
108
+ Route:
109
+
110
+ - Accepted + bounded + in scope -> recommend one fix pass next; do not perform it in the same turn that received the non-pass review.
111
+ - Non-blocking -> defer or bundle only when safe.
112
+ - Question -> ask; do not implement the answer silently.
113
+ - Needs evidence -> inspect or diagnose before editing.
114
+ - Third review pass -> diagnose; no fourth broad review.
115
+
116
+ Repeated edge-case findings are a design signal. Ask whether the module/interface is too shallow, the plan slice is wrong, the spec is under-specified, or reviewer context is stale.
117
+
118
+ ## Context And Snapshot Discipline
119
+
120
+ Do not start a slice if you cannot finish the edit, verification, and checkpoint in the current context window.
121
+
122
+ When per-slice commits are requested, a verified slice should route to `commit-work` before the next slice. When a commit is not appropriate, make a handoff if future execution depends on the slice state.
@@ -58,7 +58,7 @@ Recognize only:
58
58
  /workflow reset
59
59
  ```
60
60
 
61
- The three mode commands switch mode for the current task, conversation, or host session only. `/workflow reset` clears the current override and returns to `defaultMode`.
61
+ The three mode-setting commands switch mode for the current task, conversation, or host session only. `/workflow reset` clears the current override and returns to `defaultMode`; it is a command, not a fourth mode.
62
62
 
63
63
  Do not persist current mode, create repo state files, or edit config unless the user explicitly asks to change the repo default.
64
64
 
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: output-router
3
+ description: Use when choosing between native tools and Freeflow routed tools, retrieving repo/vault evidence, running likely-large or noisy commands, recovering vaulted output, configuring outputRouter, or handling optional native read/bash safety-net routing.
4
+ ---
5
+
6
+ # Output Router
7
+
8
+ Route output deliberately. Native tools stay direct unless explicit config enables the safety net.
9
+
10
+ ## Tool Choice
11
+
12
+ - Need existing repo or vault information: use `freeflow_retrieve`.
13
+ - Need candidate paths first: use `freeflow_retrieve action=locate`.
14
+ - Need a best evidence packet: use `freeflow_retrieve action=query`.
15
+ - Need exact known repo/vault lines: use `freeflow_retrieve action=retrieve` with `source.path` or `source.kind=vault`, plus `lineRange` when exact lines matter.
16
+ - Need more around prior evidence: use `freeflow_retrieve action=expand`.
17
+ - Need to explain a routed result or vault id: use `freeflow_retrieve action=explain`.
18
+ - Need to run a likely-large or noisy command: use `freeflow_run`.
19
+ - Need a whole known file/artifact: use native read.
20
+ - Need direct shell behavior or expected-small exact output: use native bash.
21
+ - Need to edit files: use native edit/write.
22
+
23
+ ## Hard Rules
24
+
25
+ - Do not pretend routed output is native output.
26
+ - Do not silently shorten native output. If the safety net transforms it, the result must say Freeflow routed it and include recovery instructions.
27
+ - Capture raw output before transforming it.
28
+ - Treat `preserve: full` as exact fidelity, not unlimited context injection. Over cap, return exact chunks or retrieval pointers.
29
+ - Freeflow mode changes guidance strength only. It must not enable `postToolRouting`.
30
+ - Keep `toolStatus`, `execution.status`, and `routing.status` separate.
31
+
32
+ ## Safety Policy
33
+
34
+ Read `references/safety-policy.md` before changing routing policy, reviewing router behavior, or routing exactness-sensitive output.
35
+
36
+ ## Recovery Pattern
37
+
38
+ For routed command or native safety-net output, recover exact text with:
39
+
40
+ ```json
41
+ {
42
+ "action": "retrieve",
43
+ "source": { "kind": "vault", "outputId": "ffout_...", "stream": "stdout|stderr|combined|raw" },
44
+ "lineRange": { "start": 1, "end": 20 },
45
+ "preserve": "full"
46
+ }
47
+ ```
48
+
49
+ Use `query` first when the needed lines are unknown. Use `expand` when a previous evidence packet is too narrow.
50
+
51
+ ## Config
52
+
53
+ The router works with built-in defaults. Persist `outputRouter` config only when explicitly requested; `setup-freeflow` owns repo setup/config changes.
54
+
55
+ Supported repo keys are `postToolRouting`, `largeOutputBytes`, `largeOutputLines`, `vaultRoot`, `vaultRetentionDays`, `generatedPaths`, and `noisyCommandHints`.
56
+
57
+ `outputRouter.postToolRouting` controls native read/bash safety-net routing:
58
+
59
+ - `off`: native outputs pass through unchanged.
60
+ - `safety-net`: large/noisy native read/bash output may be vaulted and labeled.
61
+ - `strict`: reserved for stronger future guards; do not invent blocking behavior.
62
+
63
+ Rules:
64
+
65
+ - Minimal setup stays only `defaultMode`.
66
+ - Do not dump defaults or create an empty `outputRouter` object.
67
+ - `generatedPaths` affects broad scans only; explicit path retrieval remains available.
68
+ - Freeflow mode changes guidance strength only. It must not enable `postToolRouting`.
69
+ - Invalid config must fall back safely with a warning.
@@ -0,0 +1,33 @@
1
+ # Output Router Safety Policy
2
+
3
+ Use this reference for exactness-sensitive output routing.
4
+
5
+ ## Main Rule
6
+
7
+ Do not silently summarize or compress exactness-sensitive output.
8
+
9
+ Exactness-sensitive output includes:
10
+
11
+ - user-requested exact/full output,
12
+ - small outputs,
13
+ - verification output needed for completion claims,
14
+ - failure evidence needed for diagnosis,
15
+ - source-truth conflict evidence,
16
+ - security, privacy, billing, data-loss, or public API evidence,
17
+ - anything marked `preserve: full`.
18
+
19
+ ## Required Behavior
20
+
21
+ - Capture raw evidence before transformation whenever output is routed.
22
+ - Label every transformed native result as Freeflow-routed output.
23
+ - Include an `outputId` and exact recovery instructions for routed output.
24
+ - Preserve exact failure and verification evidence lines; do not paraphrase them.
25
+ - Pass small native outputs through unchanged.
26
+ - For huge exactness-sensitive output, use vaulting and exact chunk retrieval instead of lossy summarization.
27
+ - If post-tool safety-net routing fails, fail open: return the native output unchanged when possible and include a warning.
28
+
29
+ ## Non-Goals
30
+
31
+ - This policy does not enable post-tool routing by itself.
32
+ - This policy does not authorize model-assisted summarization inside the router runtime.
33
+ - This policy does not require existing Freeflow skills to depend on the router runtime.
@@ -0,0 +1,58 @@
1
+ # Artifact Destinations
2
+
3
+ Use this when a research checkpoint or decision must survive beyond chat.
4
+
5
+ ## Destination Test
6
+
7
+ Before writing, answer:
8
+
9
+ - What needs to survive?
10
+ - Who will treat the destination as authority?
11
+ - Which existing artifact already owns this kind of truth?
12
+ - Would writing here create a new convention?
13
+ - Would a future agent know to look here?
14
+
15
+ If the owner is unclear, ask before writing.
16
+
17
+ ## Common Destinations
18
+
19
+ | Research output | Prefer | Avoid |
20
+ | --- | --- | --- |
21
+ | Domain term or meaning | Existing `CONTEXT.md`, glossary, or domain doc | README fallback; creating domain memory without asking |
22
+ | Feature behavior, scope, acceptance | Existing or requested spec | ADR unless the ADR test passes |
23
+ | Future implementation path | Plan | Hidden plan inside a research note |
24
+ | Evidence summary before requirements settle | Existing research/design notes, or ask | Creating `docs/research/` by default |
25
+ | Immediate continuation state | Handoff | Durable decision memory |
26
+ | Hard-to-reverse surprising tradeoff from alternatives | ADR | Product note that hides rationale |
27
+ | Rejected approach | ADR if tradeoff-heavy; otherwise spec/decision note | Changelog or README by default |
28
+ | No durable value | Chat checkpoint | New file for ceremony |
29
+
30
+ ## ADR Test
31
+
32
+ Use an ADR only when all are true:
33
+
34
+ - Hard to reverse.
35
+ - Surprising without context.
36
+ - Chosen from real alternatives.
37
+
38
+ Otherwise use the owning spec, decision note, domain doc, handoff, or chat.
39
+
40
+ ## Stop Rules
41
+
42
+ Do not create a new `CONTEXT.md`, glossary, `docs/decisions/`, `docs/specs/`, `docs/research/`, or ADR folder just because the checkpoint needs memory.
43
+
44
+ A missing destination convention is a decision point.
45
+
46
+ Do not put volatile file lists, command output, temporary TODOs, or implementation inventory in durable decision memory. Put continuation state in a handoff or plan when needed.
47
+
48
+ ## Question Shape
49
+
50
+ When destination is ambiguous, ask one direct question:
51
+
52
+ ```text
53
+ I have a checkpoint worth preserving: [what].
54
+ The narrowest destination is [recommended artifact] because [why].
55
+ Should I save it there?
56
+ ```
57
+
58
+ Do not write the artifact before the user chooses the destination.
@@ -0,0 +1,74 @@
1
+ # Research Checkpoints
2
+
3
+ A checkpoint is the output of research. It preserves the current understanding and names the next route.
4
+
5
+ Research does not end by silently writing a spec, plan, or implementation.
6
+
7
+ ## Chat Or Artifact
8
+
9
+ Keep the checkpoint in chat when the work is short-lived and the next turn can safely continue from conversation context.
10
+
11
+ Save the checkpoint when it must guide later work, another agent, a future session, or a durable artifact.
12
+
13
+ Use the narrowest owning artifact:
14
+
15
+ - Spec: behavior, scope, requirements, acceptance, product decisions.
16
+ - Plan: future implementation path and checks.
17
+ - Handoff: immediate continuation state.
18
+ - Decision note or ADR: durable tradeoff or rejected approach.
19
+ - Domain memory: stable term or domain meaning.
20
+ - Research note: evidence summary that must be reused before requirements are settled.
21
+
22
+ If no clear destination exists, ask before writing.
23
+
24
+ ## Shape
25
+
26
+ Use this shape. Omit sections that do not apply.
27
+
28
+ ```text
29
+ Question / goal: ...
30
+ Evidence: ...
31
+ Current understanding: ...
32
+ Settled: ...
33
+ Tentative: ...
34
+ Open: ...
35
+ Recommendation: ...
36
+ Next: Forward | Backward | Branch | Stop — ...
37
+ ```
38
+
39
+ ## Good Checkpoints
40
+
41
+ A good checkpoint:
42
+
43
+ - Links or names live evidence instead of copying volatile inventory.
44
+ - Separates settled facts from tentative assumptions.
45
+ - Names open decisions that change the next route.
46
+ - Recommends the next route without treating it as permission.
47
+ - Avoids hiding user-owned decisions in polished prose.
48
+
49
+ ## Bad Checkpoints
50
+
51
+ Bad:
52
+
53
+ ```text
54
+ We discussed a lot. I'll implement the recommended path.
55
+ ```
56
+
57
+ because it skips settled/tentative/open state and jumps to action.
58
+
59
+ Bad:
60
+
61
+ ```text
62
+ Decision: create docs/decisions/ and record everything.
63
+ ```
64
+
65
+ when the repo has no decision-note convention and the user has not chosen that destination.
66
+
67
+ Good:
68
+
69
+ ```text
70
+ Settled: RiskReview is manual today; $500+ invoices enter review.
71
+ Tentative: retry scheduling should assist support, not replace review.
72
+ Open: should this be support-assistive or fully automated?
73
+ Next: Backward — answer the automation-scope decision before spec.
74
+ ```
@@ -0,0 +1,61 @@
1
+ # Research Language
2
+
3
+ Use the same language as architecture review so early research shapes the codebase with the same concepts later used to review it.
4
+
5
+ ## Terms
6
+
7
+ **Module**
8
+ The thing being understood, built, or reshaped. It can be a feature, flow, artifact, repo area, package, class, function, or future slice of code.
9
+
10
+ **Interface**
11
+ Everything a user, caller, or future agent must know to use or continue the module correctly: names, inputs, invariants, ordering, error modes, ownership, and source truth.
12
+
13
+ **Implementation**
14
+ The details that can stay hidden behind the interface. Research should decide what callers must know before exposing implementation detail.
15
+
16
+ **Depth**
17
+ Leverage at the interface. Deep research makes the next spec, plan, or module simpler to use. Shallow research pushes coordination into the user, callers, or future agents.
18
+
19
+ **Seam**
20
+ Where behavior, ownership, or variation can change without rewriting surrounding work. A seam can be code, artifact, process, owner, or dependency shaped.
21
+
22
+ **Adapter**
23
+ A concrete thing satisfying an interface at a seam. Use this when something actually varies across the seam; do not invent adapters for ceremony.
24
+
25
+ **Leverage**
26
+ What one question, decision, or interface unlocks for future work.
27
+
28
+ **Locality**
29
+ Where evidence, decisions, tests, and changes should concentrate so future work can find them.
30
+
31
+ ## Deletion Tests
32
+
33
+ Question deletion test:
34
+
35
+ ```text
36
+ If I do not ask this, does downstream complexity spread?
37
+ ```
38
+
39
+ Decision deletion test:
40
+
41
+ ```text
42
+ If this is not captured, will future work rediscover or contradict it?
43
+ ```
44
+
45
+ Module deletion test:
46
+
47
+ ```text
48
+ If this module disappears, does complexity vanish or spread across callers?
49
+ ```
50
+
51
+ ## Research Use
52
+
53
+ Use domain language from `CONTEXT.md`, existing docs, tests, and code. Do not invent polished names before evidence supports them.
54
+
55
+ Name the outside first: what should users, callers, or future agents need to know? Then decide which implementation details can stay hidden.
56
+
57
+ A good research pass should make later architecture review ask:
58
+
59
+ ```text
60
+ Did we build the deep module we shaped here?
61
+ ```