@interf/compiler 0.1.12 → 0.2.1

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 (282) hide show
  1. package/README.md +197 -192
  2. package/dist/commands/benchmark.d.ts.map +1 -1
  3. package/dist/commands/benchmark.js +65 -84
  4. package/dist/commands/benchmark.js.map +1 -1
  5. package/dist/commands/compile.d.ts.map +1 -1
  6. package/dist/commands/compile.js +19 -3
  7. package/dist/commands/compile.js.map +1 -1
  8. package/dist/commands/create.d.ts +3 -0
  9. package/dist/commands/create.d.ts.map +1 -1
  10. package/dist/commands/create.js +39 -14
  11. package/dist/commands/create.js.map +1 -1
  12. package/dist/commands/default.d.ts.map +1 -1
  13. package/dist/commands/default.js +2 -0
  14. package/dist/commands/default.js.map +1 -1
  15. package/dist/commands/init.d.ts.map +1 -1
  16. package/dist/commands/init.js +8 -63
  17. package/dist/commands/init.js.map +1 -1
  18. package/dist/index.d.ts +11 -29
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +7 -16
  21. package/dist/index.js.map +1 -1
  22. package/dist/lib/agent-args.d.ts +4 -0
  23. package/dist/lib/agent-args.d.ts.map +1 -0
  24. package/dist/lib/agent-args.js +42 -0
  25. package/dist/lib/agent-args.js.map +1 -0
  26. package/dist/lib/agent-constants.d.ts +6 -0
  27. package/dist/lib/agent-constants.d.ts.map +1 -0
  28. package/dist/lib/agent-constants.js +29 -0
  29. package/dist/lib/agent-constants.js.map +1 -0
  30. package/dist/lib/agent-detection.d.ts +8 -0
  31. package/dist/lib/agent-detection.d.ts.map +1 -0
  32. package/dist/lib/agent-detection.js +66 -0
  33. package/dist/lib/agent-detection.js.map +1 -0
  34. package/dist/lib/agent-execution.d.ts +3 -0
  35. package/dist/lib/agent-execution.d.ts.map +1 -0
  36. package/dist/lib/agent-execution.js +207 -0
  37. package/dist/lib/agent-execution.js.map +1 -0
  38. package/dist/lib/agent-logs.d.ts +3 -0
  39. package/dist/lib/agent-logs.d.ts.map +1 -0
  40. package/dist/lib/agent-logs.js +18 -0
  41. package/dist/lib/agent-logs.js.map +1 -0
  42. package/dist/lib/agent-preflight.d.ts +8 -0
  43. package/dist/lib/agent-preflight.d.ts.map +1 -0
  44. package/dist/lib/agent-preflight.js +77 -0
  45. package/dist/lib/agent-preflight.js.map +1 -0
  46. package/dist/lib/agent-render.d.ts +9 -0
  47. package/dist/lib/agent-render.d.ts.map +1 -0
  48. package/dist/lib/agent-render.js +219 -0
  49. package/dist/lib/agent-render.js.map +1 -0
  50. package/dist/lib/agent-status.d.ts +4 -0
  51. package/dist/lib/agent-status.d.ts.map +1 -0
  52. package/dist/lib/agent-status.js +59 -0
  53. package/dist/lib/agent-status.js.map +1 -0
  54. package/dist/lib/agent-types.d.ts +31 -0
  55. package/dist/lib/agent-types.d.ts.map +1 -0
  56. package/dist/lib/agent-types.js +2 -0
  57. package/dist/lib/agent-types.js.map +1 -0
  58. package/dist/lib/agents.d.ts +7 -49
  59. package/dist/lib/agents.d.ts.map +1 -1
  60. package/dist/lib/agents.js +8 -554
  61. package/dist/lib/agents.js.map +1 -1
  62. package/dist/lib/benchmark-execution.d.ts +9 -0
  63. package/dist/lib/benchmark-execution.d.ts.map +1 -0
  64. package/dist/lib/benchmark-execution.js +488 -0
  65. package/dist/lib/benchmark-execution.js.map +1 -0
  66. package/dist/lib/benchmark-paths.d.ts +11 -0
  67. package/dist/lib/benchmark-paths.d.ts.map +1 -0
  68. package/dist/lib/benchmark-paths.js +38 -0
  69. package/dist/lib/benchmark-paths.js.map +1 -0
  70. package/dist/lib/benchmark-specs.d.ts +8 -0
  71. package/dist/lib/benchmark-specs.d.ts.map +1 -0
  72. package/dist/lib/benchmark-specs.js +115 -0
  73. package/dist/lib/benchmark-specs.js.map +1 -0
  74. package/dist/lib/benchmark-targets.d.ts +5 -0
  75. package/dist/lib/benchmark-targets.d.ts.map +1 -0
  76. package/dist/lib/benchmark-targets.js +72 -0
  77. package/dist/lib/benchmark-targets.js.map +1 -0
  78. package/dist/lib/benchmark-types.d.ts +19 -0
  79. package/dist/lib/benchmark-types.d.ts.map +1 -0
  80. package/dist/lib/benchmark-types.js +2 -0
  81. package/dist/lib/benchmark-types.js.map +1 -0
  82. package/dist/lib/benchmark.d.ts +4 -29
  83. package/dist/lib/benchmark.d.ts.map +1 -1
  84. package/dist/lib/benchmark.js +3 -324
  85. package/dist/lib/benchmark.js.map +1 -1
  86. package/dist/lib/bundled-templates.d.ts +5 -0
  87. package/dist/lib/bundled-templates.d.ts.map +1 -0
  88. package/dist/lib/bundled-templates.js +23 -0
  89. package/dist/lib/bundled-templates.js.map +1 -0
  90. package/dist/lib/config.d.ts +1 -0
  91. package/dist/lib/config.d.ts.map +1 -1
  92. package/dist/lib/config.js +2 -0
  93. package/dist/lib/config.js.map +1 -1
  94. package/dist/lib/eval-packs.d.ts +204 -0
  95. package/dist/lib/eval-packs.d.ts.map +1 -0
  96. package/dist/lib/eval-packs.js +177 -0
  97. package/dist/lib/eval-packs.js.map +1 -0
  98. package/dist/lib/execution-profile.d.ts +18 -0
  99. package/dist/lib/execution-profile.d.ts.map +1 -0
  100. package/dist/lib/execution-profile.js +85 -0
  101. package/dist/lib/execution-profile.js.map +1 -0
  102. package/dist/lib/interf-bootstrap.d.ts +4 -0
  103. package/dist/lib/interf-bootstrap.d.ts.map +1 -1
  104. package/dist/lib/interf-bootstrap.js +71 -68
  105. package/dist/lib/interf-bootstrap.js.map +1 -1
  106. package/dist/lib/interf-compile-plan.d.ts +12 -0
  107. package/dist/lib/interf-compile-plan.d.ts.map +1 -0
  108. package/dist/lib/interf-compile-plan.js +143 -0
  109. package/dist/lib/interf-compile-plan.js.map +1 -0
  110. package/dist/lib/interf-detect.d.ts.map +1 -1
  111. package/dist/lib/interf-detect.js +11 -10
  112. package/dist/lib/interf-detect.js.map +1 -1
  113. package/dist/lib/interf-scaffold.d.ts +1 -10
  114. package/dist/lib/interf-scaffold.d.ts.map +1 -1
  115. package/dist/lib/interf-scaffold.js +25 -362
  116. package/dist/lib/interf-scaffold.js.map +1 -1
  117. package/dist/lib/interf-workflow-package.d.ts +4 -0
  118. package/dist/lib/interf-workflow-package.d.ts.map +1 -0
  119. package/dist/lib/interf-workflow-package.js +131 -0
  120. package/dist/lib/interf-workflow-package.js.map +1 -0
  121. package/dist/lib/interf.d.ts +2 -1
  122. package/dist/lib/interf.d.ts.map +1 -1
  123. package/dist/lib/interf.js +2 -1
  124. package/dist/lib/interf.js.map +1 -1
  125. package/dist/lib/local-workflows.d.ts.map +1 -1
  126. package/dist/lib/local-workflows.js +8 -12
  127. package/dist/lib/local-workflows.js.map +1 -1
  128. package/dist/lib/logger.d.ts +4 -0
  129. package/dist/lib/logger.d.ts.map +1 -0
  130. package/dist/lib/logger.js +11 -0
  131. package/dist/lib/logger.js.map +1 -0
  132. package/dist/lib/obsidian.d.ts.map +1 -1
  133. package/dist/lib/obsidian.js +7 -3
  134. package/dist/lib/obsidian.js.map +1 -1
  135. package/dist/lib/parse.d.ts +2 -2
  136. package/dist/lib/parse.d.ts.map +1 -1
  137. package/dist/lib/parse.js +11 -7
  138. package/dist/lib/parse.js.map +1 -1
  139. package/dist/lib/registry.js +3 -3
  140. package/dist/lib/registry.js.map +1 -1
  141. package/dist/lib/runtime-acceptance.d.ts +4 -0
  142. package/dist/lib/runtime-acceptance.d.ts.map +1 -0
  143. package/dist/lib/runtime-acceptance.js +123 -0
  144. package/dist/lib/runtime-acceptance.js.map +1 -0
  145. package/dist/lib/runtime-contracts.d.ts +4 -0
  146. package/dist/lib/runtime-contracts.d.ts.map +1 -0
  147. package/dist/lib/runtime-contracts.js +63 -0
  148. package/dist/lib/runtime-contracts.js.map +1 -0
  149. package/dist/lib/runtime-paths.d.ts +8 -0
  150. package/dist/lib/runtime-paths.d.ts.map +1 -0
  151. package/dist/lib/runtime-paths.js +28 -0
  152. package/dist/lib/runtime-paths.js.map +1 -0
  153. package/dist/lib/runtime-prompt.d.ts +3 -0
  154. package/dist/lib/runtime-prompt.d.ts.map +1 -0
  155. package/dist/lib/runtime-prompt.js +59 -0
  156. package/dist/lib/runtime-prompt.js.map +1 -0
  157. package/dist/lib/runtime-reconcile.d.ts +6 -0
  158. package/dist/lib/runtime-reconcile.d.ts.map +1 -0
  159. package/dist/lib/runtime-reconcile.js +339 -0
  160. package/dist/lib/runtime-reconcile.js.map +1 -0
  161. package/dist/lib/runtime-runs.d.ts +12 -0
  162. package/dist/lib/runtime-runs.d.ts.map +1 -0
  163. package/dist/lib/runtime-runs.js +337 -0
  164. package/dist/lib/runtime-runs.js.map +1 -0
  165. package/dist/lib/runtime-types.d.ts +42 -0
  166. package/dist/lib/runtime-types.d.ts.map +1 -0
  167. package/dist/lib/runtime-types.js +2 -0
  168. package/dist/lib/runtime-types.js.map +1 -0
  169. package/dist/lib/runtime.d.ts +6 -58
  170. package/dist/lib/runtime.d.ts.map +1 -1
  171. package/dist/lib/runtime.js +5 -614
  172. package/dist/lib/runtime.js.map +1 -1
  173. package/dist/lib/schema.d.ts +156 -13
  174. package/dist/lib/schema.d.ts.map +1 -1
  175. package/dist/lib/schema.js +113 -4
  176. package/dist/lib/schema.js.map +1 -1
  177. package/dist/lib/source-config.d.ts +13 -0
  178. package/dist/lib/source-config.d.ts.map +1 -0
  179. package/dist/lib/source-config.js +75 -0
  180. package/dist/lib/source-config.js.map +1 -0
  181. package/dist/lib/state-artifacts.d.ts +15 -0
  182. package/dist/lib/state-artifacts.d.ts.map +1 -0
  183. package/dist/lib/state-artifacts.js +24 -0
  184. package/dist/lib/state-artifacts.js.map +1 -0
  185. package/dist/lib/state-health.d.ts +9 -0
  186. package/dist/lib/state-health.d.ts.map +1 -0
  187. package/dist/lib/state-health.js +330 -0
  188. package/dist/lib/state-health.js.map +1 -0
  189. package/dist/lib/state-io.d.ts +15 -0
  190. package/dist/lib/state-io.d.ts.map +1 -0
  191. package/dist/lib/state-io.js +219 -0
  192. package/dist/lib/state-io.js.map +1 -0
  193. package/dist/lib/state-paths.d.ts +5 -0
  194. package/dist/lib/state-paths.d.ts.map +1 -0
  195. package/dist/lib/state-paths.js +19 -0
  196. package/dist/lib/state-paths.js.map +1 -0
  197. package/dist/lib/state-view.d.ts +7 -0
  198. package/dist/lib/state-view.d.ts.map +1 -0
  199. package/dist/lib/state-view.js +147 -0
  200. package/dist/lib/state-view.js.map +1 -0
  201. package/dist/lib/state.d.ts +6 -46
  202. package/dist/lib/state.d.ts.map +1 -1
  203. package/dist/lib/state.js +5 -632
  204. package/dist/lib/state.js.map +1 -1
  205. package/dist/lib/summarize-plan.d.ts +1 -0
  206. package/dist/lib/summarize-plan.d.ts.map +1 -1
  207. package/dist/lib/summarize-plan.js +10 -0
  208. package/dist/lib/summarize-plan.js.map +1 -1
  209. package/dist/lib/user-config.js +2 -2
  210. package/dist/lib/user-config.js.map +1 -1
  211. package/dist/lib/validate-helpers.d.ts +21 -0
  212. package/dist/lib/validate-helpers.d.ts.map +1 -0
  213. package/dist/lib/validate-helpers.js +72 -0
  214. package/dist/lib/validate-helpers.js.map +1 -0
  215. package/dist/lib/validate-interface.d.ts +2 -0
  216. package/dist/lib/validate-interface.d.ts.map +1 -1
  217. package/dist/lib/validate-interface.js +103 -53
  218. package/dist/lib/validate-interface.js.map +1 -1
  219. package/dist/lib/validate-kb.d.ts +8 -0
  220. package/dist/lib/validate-kb.d.ts.map +1 -1
  221. package/dist/lib/validate-kb.js +53 -24
  222. package/dist/lib/validate-kb.js.map +1 -1
  223. package/dist/lib/validate.d.ts +1 -1
  224. package/dist/lib/validate.d.ts.map +1 -1
  225. package/dist/lib/validate.js +5 -2
  226. package/dist/lib/validate.js.map +1 -1
  227. package/dist/lib/workflow-definitions.d.ts +1 -1
  228. package/dist/lib/workflow-definitions.d.ts.map +1 -1
  229. package/dist/lib/workflow-definitions.js +90 -166
  230. package/dist/lib/workflow-definitions.js.map +1 -1
  231. package/dist/lib/workflow-helpers.d.ts.map +1 -1
  232. package/dist/lib/workflow-helpers.js +6 -3
  233. package/dist/lib/workflow-helpers.js.map +1 -1
  234. package/dist/lib/workflow-stage-runner.d.ts +41 -0
  235. package/dist/lib/workflow-stage-runner.d.ts.map +1 -0
  236. package/dist/lib/workflow-stage-runner.js +106 -0
  237. package/dist/lib/workflow-stage-runner.js.map +1 -0
  238. package/dist/lib/workflow-starter-docs.d.ts +9 -0
  239. package/dist/lib/workflow-starter-docs.d.ts.map +1 -0
  240. package/dist/lib/workflow-starter-docs.js +18 -0
  241. package/dist/lib/workflow-starter-docs.js.map +1 -0
  242. package/dist/lib/workflows-interface-contracts.d.ts +24 -0
  243. package/dist/lib/workflows-interface-contracts.d.ts.map +1 -0
  244. package/dist/lib/workflows-interface-contracts.js +304 -0
  245. package/dist/lib/workflows-interface-contracts.js.map +1 -0
  246. package/dist/lib/workflows-interface.d.ts +3 -10
  247. package/dist/lib/workflows-interface.d.ts.map +1 -1
  248. package/dist/lib/workflows-interface.js +117 -365
  249. package/dist/lib/workflows-interface.js.map +1 -1
  250. package/dist/lib/workflows-kb.d.ts.map +1 -1
  251. package/dist/lib/workflows-kb.js +79 -55
  252. package/dist/lib/workflows-kb.js.map +1 -1
  253. package/dist/lib/workflows.d.ts.map +1 -1
  254. package/dist/lib/workflows.js +1 -1
  255. package/dist/lib/workflows.js.map +1 -1
  256. package/package.json +15 -4
  257. package/skills/interface/analyze/SKILL.md +79 -28
  258. package/skills/interface/compile/SKILL.md +27 -28
  259. package/skills/interface/create/SKILL.md +53 -230
  260. package/skills/interface/create/references/compile-plan-format.md +31 -31
  261. package/skills/interface/create/references/workflows.md +17 -32
  262. package/skills/interface/query/SKILL.md +15 -1
  263. package/skills/interface/retrieve/SKILL.md +32 -65
  264. package/skills/knowledge-base/compile/SKILL.md +59 -83
  265. package/skills/knowledge-base/compile/references/stage-claims.md +1 -1
  266. package/skills/knowledge-base/compile/references/stage-entities.md +2 -2
  267. package/skills/knowledge-base/query/SKILL.md +13 -1
  268. package/skills/knowledge-base/summarize/SKILL.md +54 -24
  269. package/templates/interface/README.md +13 -12
  270. package/templates/interface/interfaces.md +14 -11
  271. package/templates/knowledge-base/README.md +0 -1
  272. package/templates/knowledge-base/registry.md +15 -15
  273. package/templates/workflow-package/README.md +16 -0
  274. package/templates/workflow-package/create/SKILL.md +8 -0
  275. package/templates/workflow-package/interface-query/SKILL.md +29 -0
  276. package/templates/workflow-package/interface-stage/SKILL.md +13 -0
  277. package/templates/workflow-package/knowledge-base-query/SKILL.md +36 -0
  278. package/templates/workflow-package/knowledge-base-stage/SKILL.md +13 -0
  279. package/templates/workflow-starters/interface/interf/README.md +13 -0
  280. package/templates/workflow-starters/interface/interf/create/SKILL.md +15 -0
  281. package/templates/workflow-starters/knowledge-base/interf/README.md +13 -0
  282. package/templates/workflow-starters/knowledge-base/karpathy/README.md +13 -0
@@ -27,12 +27,11 @@ Harness role:
27
27
  1. Read `interf.json` and confirm `type: knowledge-base`.
28
28
  2. Read `.interf/stage-contract.json` and treat it as authoritative.
29
29
  3. Read `.interf/summarize-targets.json` when present and treat `targets[]` as the source of truth for which files to summarize.
30
+ If a target includes `output`, write the summary to that exact relative path.
30
31
  4. Read any local docs listed by the stage contract.
31
32
  5. Create one summary file in `summaries/` for each target source file.
32
33
  6. Write `.interf/inventory.json`.
33
- 7. Update `.interf/state.json`.
34
- 8. Refresh `.interf/health.json`.
35
- 9. Emit `DONE:` and stop.
34
+ 7. Emit `DONE:` and stop.
36
35
 
37
36
  If the CLI provided a summarize plan, do not re-audit the whole knowledge base before writing summaries.
38
37
 
@@ -40,14 +39,39 @@ If the CLI provided a summarize plan, do not re-audit the whole knowledge base b
40
39
 
41
40
  When launched by the Interf CLI:
42
41
  - emit exactly one startup line: `STATUS: loaded summarize plan N files`
43
- - emit `STATUS: batch committed` only after summary files, inventory, and state were actually written
44
- - emit `DONE: summarized N/N` when the required writes are complete
42
+ - emit `STATUS: batch committed` only after summary files and inventory were actually written
43
+ - emit `DONE: summarize complete N/N` when the required writes are complete
45
44
  - do not emit per-file progress
46
45
 
46
+ ## Execution bias
47
+
48
+ This stage is a light per-file evidence pass, not a mini research project.
49
+
50
+ - process only the files listed in `.interf/summarize-targets.json`
51
+ - for a single large PDF, deck, or report, do one lightweight evidence pass and then stop
52
+ - for a single large PDF, deck, or report, do at most one routing pass across the document plus one focused follow-up read that covers no more than 3 routed pages or sections
53
+ - capture the file's scope, headline facts that are directly exposed, and whether important evidence also lives in charts or tables
54
+ - if the document repeats the same template across many pages or entities, sample only enough pages to describe that repeated structure and preserve routing for later interfaces
55
+ - do not chase every page, every market, every appendix, or every historical chart in this stage
56
+ - leave narrow task-specific extraction to interface workflows
57
+ - once you can state the document scope, the exposed headline metrics, and where deeper chart/table evidence lives, write the summary immediately
58
+ - once the summary file and inventory are written, stop immediately
59
+ - keep bulk PDF/OCR extraction output out of the run log. Save scratch output to temp files and inspect only the routed slices you need for the summary.
60
+ - keep scratch extraction commands single-purpose and non-destructive. Do not use `rm`, wildcard cleanup, `;`, or `&&` chains during summarize.
61
+ - if a shell pattern is blocked, do not retry the same chained command with minor edits. Switch to a simpler local read path and keep moving.
62
+ - if you have already checked whether the summary file exists and it does not, the next step is to write it rather than doing another exploratory read
63
+ - do not precreate `.interf/inventory.json` with `touch`; write the final JSON document directly
64
+ - when updating `.interf/inventory.json`, rewrite the full JSON document in one whole-file write instead of appending or patching partial lines
65
+ - do not use `apply_patch` or line-matched diffs on `.interf/inventory.json`; replace the file in one complete write
66
+ - when you are ready to write, prefer a direct whole-file shell write such as `cat > path <<'EOF' ... EOF` for summary markdown and the inventory artifact
67
+ - whole-file shell writes for stage artifacts are allowed and preferred here; do not stall deciding between patch-based editing and direct writes
68
+
47
69
  ## Summary output format
48
70
 
49
71
  Create one markdown file per source file under `summaries/`.
50
72
  Every summary filename must end in `.md`, even when the source file is `.txt`, `.pdf`, or another format.
73
+ If the source file already ends in `.md`, keep a single `.md` suffix instead of appending another one.
74
+ When `.interf/summarize-targets.json` provides `targets[].output`, use that exact path instead of inferring a filename.
51
75
 
52
76
  Each summary must include JSON frontmatter with:
53
77
  - `source`
@@ -85,38 +109,44 @@ Keep summaries source-grounded:
85
109
  - keep titles descriptive and conservative
86
110
  - preserve evidence tiers and truth modes
87
111
  - keep links sparse and obvious
112
+ - for PDFs, decks, and reports, capture material table/chart/figure evidence when it affects the source's meaning
113
+ - preserve the main headline metrics for the top-level sections or market groups when they are present in extractable text
114
+ - preserve easy headline values from prose or clearly exposed tables when they are central to the source
115
+ - for market reports and dashboards, preserve the main peer groups that are trivial to recover from prose or headline tables, but do not turn summarize into a full market-by-market extraction pass
116
+ - if important evidence appears to live in charts or other visuals, say that clearly in the summary and preserve enough routing detail for a later interface or manual query step
117
+ - do not turn the knowledge-base summarize stage into an exhaustive visual extraction pass across the whole report
118
+ - if exact chart numbers are not directly recoverable from the same page with light local extraction, say so explicitly in the summary instead of flattening the evidence into vague prose
119
+ - when useful, note whether important evidence came from prose, tables, or charts so later interface stages know when raw visual inspection may still be needed
120
+ - distinguish `chart present and relevant` from `exact chart values not yet extracted`
88
121
 
89
122
  This is a per-file evidence stage only. Cross-file synthesis belongs to `knowledge-base/compile`.
90
123
 
91
- ## Inventory and state
124
+ ## Inventory output
92
125
 
93
126
  Write `.interf/inventory.json` so every source file is accounted for.
94
127
 
95
128
  Minimum shape:
129
+ - prefer the current runtime shape: top-level `entries` plus `total`
130
+ - `total` equal to the actual current source-file count
131
+ - one `entries[]` object per source file
132
+ - each entry should preserve at least `source`, `summary`, and a conservative summarize `status` or `state`
133
+ - per-file routing must let the runtime and validators see which raw file maps to which summary
96
134
 
97
- ```json
98
- {
99
- "total": 3,
100
- "files": [
101
- {
102
- "raw": "company-overview.md",
103
- "summary": "summaries/company overview.md",
104
- "status": "summarized"
105
- }
106
- ]
107
- }
108
- ```
109
-
110
- Update `.interf/state.json` with:
111
- - `pending`
112
- - `summarized`
113
- - `last_summarize`
135
+ Do not copy canned totals or filenames into the runtime inventory.
136
+ Do not invent new top-level inventory keys when `entries` already fits the run.
114
137
 
115
- Refresh `.interf/health.json` after state is updated.
138
+ The CLI reconciles `.interf/state.json` and refreshes `.interf/health.json` after stage validation.
139
+ For a one-file summarize run, the finish sequence is strict: write the summary file, rewrite `.interf/inventory.json`, emit `STATUS: batch committed`, emit the standard summarize `DONE:` line using the current run counts, and stop.
116
140
 
117
141
  ## Guardrails
118
142
 
119
143
  - Do not modify source files.
120
144
  - Do not emit `STATUS: batch committed` before files exist on disk.
145
+ - Do not create placeholder JSON files with `touch` before writing the final documents.
146
+ - Do not append a second JSON object to `.interf/inventory.json`. Rewrite the whole file once.
147
+ - Do not use `apply_patch` or line-matched diffs to edit `.interf/inventory.json`.
148
+ - Use a single whole-file write for each required artifact as soon as the summary text is ready.
149
+ - If you check whether a required summary or inventory artifact exists and it is missing, create it next instead of doing another exploratory read.
150
+ - Do not keep mining the source after a usable conservative summary already exists.
121
151
  - Do not keep browsing after the required writes are complete.
122
152
  - If a required path is missing or unreadable, emit one `BLOCKED:` or `ERROR:` line with the concrete reason and stop.
@@ -44,13 +44,12 @@ State bridges between steps. If step 2 fails, the next run resumes from step 2.
44
44
 
45
45
  ## Workflows
46
46
 
47
- Shipped interface workflows:
48
- - `briefing`
49
- - `research`
50
- - `audit`
47
+ Shipped built-in interface workflow:
48
+ - `interf`
51
49
 
52
50
  The selected workflow is written to `interf.json` and can seed starter local `workflow/` docs.
53
- Create new reusable workflows from the wizard when you want a named local variation.
51
+ Use `compile-plan.md` for interface-specific direction such as target entities, years, metrics, chart families, and output focus.
52
+ Create a reusable local workflow only when you want a named method variation you expect to reuse across multiple interfaces.
54
53
 
55
54
  ## Bundled stage skills
56
55
 
@@ -69,17 +68,18 @@ Minimal. Source of truth for type and knowledge-base reference.
69
68
  {
70
69
  "type": "interface",
71
70
  "name": "weekly-briefing",
72
- "workflow": "briefing",
71
+ "workflow": "interf",
73
72
  "knowledge_base": {
74
73
  "path": "../.."
75
74
  }
76
75
  }
77
76
  ```
78
77
 
79
- `knowledge_base.path` points to the parent knowledge base. All filter criteria, extraction goals, and output specs live in `compile-plan.md`.
80
- `workflow` records the selected methodology. Interf generates per-run stage contracts from it for this interface.
78
+ `knowledge_base.path` points to the parent knowledge base. All interface-specific filter criteria, extraction goals, and output specs live in `compile-plan.md`.
79
+ `workflow` records the selected reusable method. Interf generates per-run stage contracts from it for this interface.
81
80
 
82
- If you want different retrieval, ontology, or output bias, use a workflow and local `workflow/`.
81
+ If you want to specialize this specific interface, refine `compile-plan.md`.
82
+ If you want a reusable retrieval, ontology, or output method, use a workflow and local `workflow/`.
83
83
  If you want a different stage graph, proof model, or required artifacts, that is effectively a new workflow.
84
84
 
85
85
  `AGENTS.md` is the source of truth. `CLAUDE.md` is a generated mirror so Claude Code picks up the same interface instructions automatically.
@@ -109,7 +109,7 @@ If you need a different stage chain, artifact contract, or verifier flow, create
109
109
  If your coding agent is sandboxed to the current directory tree, launch it from the source folder so the source root, knowledge base, and this interface all stay reachable.
110
110
  Use `../../.interf/source-access.json` to verify that raw files are actually reachable before you depend on raw fallback in a manual agent session. `suggested_checks` are canonical absolute file paths so they remain valid from inside the interface folder.
111
111
 
112
- If Obsidian viewer defaults are enabled during `interf init`, newly created interfaces get minimal `.obsidian/graph.json` defaults. They are not registered as standalone vaults by default; browse them from the parent knowledge-base vault so knowledge-base summaries and source links remain navigable.
112
+ If Obsidian viewer defaults are enabled during `interf init`, newly created interfaces get minimal `.obsidian/graph.json` defaults. They are not registered as standalone workspaces by default; browse them from the parent knowledge-base workspace in Obsidian so knowledge-base summaries and source links remain navigable.
113
113
 
114
114
  ## Runtime files
115
115
 
@@ -136,7 +136,8 @@ Generated by `interface/create`. Defines:
136
136
  - Stage 2: extraction goals and allowed runtime refinements
137
137
  - Stage 3: output specs for the local context shell
138
138
 
139
- This is the initial interface definition. Compile can refine it when the evidence clearly demands better local structure.
139
+ This is the interface-specific customization layer for the built-in `interf` workflow unless you choose a reusable local workflow instead.
140
+ Compile can refine it when the evidence clearly demands better local structure.
140
141
 
141
142
  ## Key principles
142
143
 
@@ -153,6 +154,6 @@ This is the initial interface definition. Compile can refine it when the evidenc
153
154
  ## Reset
154
155
 
155
156
  ```text
156
- interf reset compile remove knowledge/ + briefs/ + summaries/, keep config
157
+ interf reset compile remove knowledge/ + briefs/, keep summaries/ + config
157
158
  interf reset all remove all generated content, preserve config files
158
159
  ```
@@ -1,14 +1,17 @@
1
- # Interface Workflows
1
+ # Interface Patterns
2
2
 
3
- Pre-designed interface workflows. Each defines a use case, guiding questions, filter criteria, output inventory, and benchmark queries for validation.
3
+ Interf currently ships one built-in interface workflow: `interf`.
4
+ That workflow always runs retrieve -> analyze -> compile.
4
5
 
5
- When `interf create interface` builds an interface, it starts from one of these workflows and adapts it to the selected knowledge-base data.
6
+ What changes from interface to interface is the use case, the `compile-plan.md` customization, and any optional local workflow extension docs.
6
7
 
7
- Benchmark queries exist today as validation prompts and expected behaviors. The automated benchmark runner and score logging loop are planned, not yet implemented in the engine.
8
+ Use the patterns below as planning lenses you can encode in `compile-plan.md` or a reusable local interface workflow. They are not built-in workflow ids.
9
+
10
+ Benchmark queries exist today as validation prompts and expected behaviors. The automated benchmark runner and score logging loop are implemented separately from this shipped template reference.
8
11
 
9
12
  ---
10
13
 
11
- ## briefing
14
+ ## Current-State Briefing Lens
12
15
 
13
16
  Current-state briefing. Best when you want the latest truth, recent changes, and immediate next steps.
14
17
 
@@ -34,7 +37,7 @@ Current-state briefing. Best when you want the latest truth, recent changes, and
34
37
 
35
38
  ---
36
39
 
37
- ## research
40
+ ## Research Synthesis Lens
38
41
 
39
42
  Research synthesis. Best when you want themes, contradictions, evidence strength, and open questions from a dense knowledge base.
40
43
 
@@ -60,7 +63,7 @@ Research synthesis. Best when you want themes, contradictions, evidence strength
60
63
 
61
64
  ---
62
65
 
63
- ## audit
66
+ ## Gap Review Lens
64
67
 
65
68
  Audit and gap-finding. Best when you want to improve knowledge-base quality, spot stale areas, and surface missing or contradictory evidence.
66
69
 
@@ -84,12 +87,12 @@ Audit and gap-finding. Best when you want to improve knowledge-base quality, spo
84
87
 
85
88
  ---
86
89
 
87
- ## Self-improving loop (planned runner)
90
+ ## Self-improving Loop
88
91
 
89
- Every interface workflow includes benchmark queries. The intended validation cycle is:
92
+ Every interface can carry benchmark queries. The intended validation cycle is:
90
93
 
91
- 1. Build the interface from its config
92
- 2. Run benchmark queries against the vault
94
+ 1. Build the interface from its config and current compile plan
95
+ 2. Run benchmark queries against the compiled interface workspace
93
96
  3. Score: did each query return expected behavior?
94
97
  4. If score is below threshold:
95
98
  - Analyze failures
@@ -133,6 +133,5 @@ See `docs/runtime-contract.md` for the human-readable contract and `src/lib/sche
133
133
 
134
134
  ```text
135
135
  interf reset compile remove knowledge/, keep summaries/
136
- interf reset summarize remove summaries/
137
136
  interf reset all remove all generated content, preserve source files
138
137
  ```
@@ -9,8 +9,8 @@ The registry at `~/.interf/registry.json` tracks all knowledge bases and interfa
9
9
  "version": 5,
10
10
  "knowledgeBases": [
11
11
  {
12
- "name": "research",
13
- "path": "/path/to/research",
12
+ "name": "market-intel",
13
+ "path": "/path/to/market-intel",
14
14
  "workflow": "interf",
15
15
  "created": "2026-03-30T14:00:00Z"
16
16
  },
@@ -23,19 +23,19 @@ The registry at `~/.interf/registry.json` tracks all knowledge bases and interfa
23
23
  ],
24
24
  "interfaces": [
25
25
  {
26
- "name": "weekly-briefing",
27
- "path": "/path/to/weekly-briefing",
26
+ "name": "q2-launch-brief",
27
+ "path": "/path/to/q2-launch-brief",
28
28
  "knowledgeBase": "ops",
29
29
  "knowledgeBasePath": "/path/to/ops",
30
- "workflow": "briefing",
30
+ "workflow": "interf",
31
31
  "created": "2026-03-30T16:00:00Z"
32
32
  },
33
33
  {
34
- "name": "gap-audit",
35
- "path": "/path/to/gap-audit",
36
- "knowledgeBase": "research",
37
- "knowledgeBasePath": "/path/to/research",
38
- "workflow": "audit",
34
+ "name": "pricing-gap-review",
35
+ "path": "/path/to/pricing-gap-review",
36
+ "knowledgeBase": "market-intel",
37
+ "knowledgeBasePath": "/path/to/market-intel",
38
+ "workflow": "interf",
39
39
  "created": "2026-03-30T16:30:00Z"
40
40
  }
41
41
  ]
@@ -55,7 +55,7 @@ The registry at `~/.interf/registry.json` tracks all knowledge bases and interfa
55
55
  - `path` — absolute path to interface root
56
56
  - `knowledgeBase` — name of the connected knowledge base
57
57
  - `knowledgeBasePath` — absolute path to the connected knowledge base
58
- - `workflow` — selected methodology
58
+ - `workflow` — selected methodology (`interf` for the shipped default, or a local workflow id)
59
59
  - `created` — ISO timestamp
60
60
 
61
61
  ## When it's updated
@@ -96,13 +96,13 @@ $ interf list
96
96
 
97
97
  Knowledge Bases
98
98
  ─────────────────────────────────
99
- research 1,240 files compiled
100
- ops 892 files 3 pending
99
+ market-intel 1,240 files compiled
100
+ ops 892 files 3 pending
101
101
 
102
102
  Interfaces
103
103
  ─────────────────────────────────
104
- weekly-briefing → ops compiled
105
- gap-audit research stale (12 new)
104
+ q2-launch-brief → ops compiled
105
+ pricing-gap-review market-intel stale (12 new)
106
106
  ```
107
107
 
108
108
  ## Creation
@@ -0,0 +1,16 @@
1
+ # {{workflow_label}}
2
+
3
+ This is the local {{target_type}} workflow package. Interf uses it when you run `interf compile`.
4
+
5
+ - `workflow.json` defines the stage graph and contract kinds for this workspace.
6
+ - `create/` explains what the scaffold/setup step produces.
7
+ - `compile/stages/` contains one stage folder per compile stage.
8
+ - `use/query/` explains how to use the compiled knowledge base or interface in manual agent sessions.
9
+
10
+ Workflow id: `{{workflow_id}}`
11
+ Method: {{workflow_hint}}
12
+
13
+ Compile stages:
14
+ {{stage_lines}}
15
+
16
+ Interf CLI remains the referee for contracts, proofs, validators, and runtime state under `.interf/`.
@@ -0,0 +1,8 @@
1
+ # Create
2
+
3
+ This doc explains what Interf scaffolded for the selected {{target_type}} workflow.
4
+
5
+ - selected workflow: `{{workflow_id}}`
6
+ - method: {{workflow_hint}}
7
+ - the CLI owns create-time validation, folder creation, config writing, and bootstrap docs
8
+ - edit this workflow package after scaffold if you want to refine how later compile/query behavior works
@@ -0,0 +1,29 @@
1
+ # Interface Query
2
+
3
+ {{top_preflight}}
4
+ Use this skill when answering questions from inside this interface in a manual agent session.
5
+ AGENTS.md should route manual questions here before an agent starts browsing notes on its own.
6
+ Treat this as the interface-local query layer, not a replacement for the parent knowledge-base query loop.
7
+ This is a workspace-local query doc, not a required globally installed slash-command skill.
8
+
9
+ Default loop:
10
+ - start with `AGENTS.md`, then `home.md`
11
+ - browse local `knowledge/`, `briefs/`, and local `summaries/` first
12
+ - answer direct target questions from the hero brief before widening scope
13
+ - follow wikilinks and backlinks outward before treating one note as complete
14
+ - if local interface artifacts are insufficient, load and follow the parent knowledge-base query guidance at `../../workflow/use/query/SKILL.md` before going raw
15
+ - use parent knowledge-base artifacts in this order: `../../home.md`, then `../../knowledge/`, then `../../summaries/`
16
+ - when a caller asks for a trace, audit log, or `artifacts_consulted` list, record local `workflow/use/query/SKILL.md` after you inspect it
17
+ - when you climb to the parent knowledge-base query loop, record `../../workflow/use/query/SKILL.md` after you inspect it
18
+
19
+ First-reply rule:
20
+ {{first_reply_rule}}
21
+
22
+ Task bias:
23
+ - reuse the exact metric and period words from the question
24
+ - if the target ledger marks a value approximate, say the literal word `approximate`
25
+ - if the target ledger marks a value chart-derived or table-derived, say that literally
26
+ - prefer the target ledger's `bin_choice` when the question is bin-shaped, and the `value_display` when the question asks for the approximate reading itself
27
+ - do not add raw-access commentary unless the question asks about raw access
28
+
29
+ Keep the interface-specific routing here. Keep raw-source, PDF/chart, and general fallback policy in `../../workflow/use/query/SKILL.md`.
@@ -0,0 +1,13 @@
1
+ ---
2
+ {
3
+ "mode": "extend"
4
+ }
5
+ ---
6
+ # {{stage_label}}
7
+
8
+ This workflow stage customizes the built-in {{contract_type}} contract for the `{{workflow_id}}` interface workflow.
9
+
10
+ - purpose: {{stage_description}}
11
+ {{stage_notes}}
12
+
13
+ Interf still enforces the same contract reads, writes, coverage proof rules, validators, and runtime reconciliation for this stage.
@@ -0,0 +1,36 @@
1
+ # Knowledge Base Query
2
+
3
+ {{top_preflight}}
4
+ Use this skill when answering questions from inside this knowledge base in a manual agent session.
5
+ AGENTS.md should route manual questions here before an agent starts browsing notes on its own.
6
+ This is the canonical parent-knowledge-base query loop that attached interfaces can inherit before raw fallback.
7
+ This is a workspace-local query doc, not a required globally installed slash-command skill.
8
+
9
+ Default loop:
10
+ - start with `AGENTS.md`, then `home.md`
11
+ - browse `knowledge/` indexes, entities, and claims first
12
+ - follow wikilinks and backlinks outward before treating one note as complete
13
+ - use `summaries/` for deeper evidence
14
+ - use raw source files only when needed for verification, direct quotes, ambiguity, or missing context
15
+ - when a caller asks for a trace, audit log, or `artifacts_consulted` list, record `workflow/use/query/SKILL.md` after you inspect it
16
+
17
+ Raw-source gate:
18
+ - inspect `.interf/source-access.json` before depending on raw files
19
+ - actually open and inspect at least one `suggested_checks` path before claiming raw-file verification; a plain existence check is not enough
20
+ - if raw files are not reachable, say the answer is based on compiled knowledge-base artifacts only
21
+ - when the question depends on exact figures, direct quotes, chart values, table values, or image-derived evidence, raw inspection is required before answering confidently
22
+
23
+ PDF / chart rule:
24
+ - if the source is a PDF, deck, or report and the needed evidence may live in charts, tables, or figures, do not assume the default text layer or existing notes captured everything
25
+ - if summaries do not preserve the needed numeric detail, inspect the raw source and say whether the value was text-derived, table-derived, or chart-derived
26
+ - opening the PDF with `Read` is not enough for an exact-value chart question; take a machine-readable extraction path before answering
27
+ - choose that extraction path from the local environment you actually have instead of assuming specific tools
28
+ - verify the chosen local extraction path is actually available before depending on it; if it is missing, switch once to another available local path
29
+ - if the first local extraction method misses the number, attempt another local recovery path before settling for a visual estimate
30
+ - if the chart does not expose exact numbers as text, say that clearly instead of pretending the compiled notes were sufficient
31
+ - if you can only estimate from the chart, label the answer `approximate` and keep the precision gap explicit
32
+
33
+ First-reply rule:
34
+ {{first_reply_rule}}
35
+
36
+ You can edit this file to bias manual question-answering behavior without changing workflow stage logic.
@@ -0,0 +1,13 @@
1
+ ---
2
+ {
3
+ "mode": "extend"
4
+ }
5
+ ---
6
+ # {{stage_label}}
7
+
8
+ This workflow stage customizes the built-in {{contract_type}} contract for the `{{workflow_id}}` knowledge-base workflow.
9
+
10
+ - purpose: {{stage_description}}
11
+ {{stage_notes}}
12
+
13
+ Interf still enforces the same contract reads, writes, proof rules, validators, and runtime reconciliation for this stage.
@@ -0,0 +1,13 @@
1
+ ---
2
+ {
3
+ "mode": "extend"
4
+ }
5
+ ---
6
+ # Interf Interface Workflow
7
+
8
+ Bias this interface toward the concrete user task, durable evidence routing, and answer-ready outputs.
9
+
10
+ - turn the requested task into a bounded target set before broadening scope
11
+ - preserve named entities, periods, metrics, units, and comparators instead of collapsing them into generic prose
12
+ - when exact values matter, keep text-derived, table-derived, and chart-derived evidence distinct
13
+ - prefer one concise hero brief and the smallest supporting note set that lets weaker agents answer reliably
@@ -0,0 +1,15 @@
1
+ ---
2
+ {
3
+ "mode": "extend"
4
+ }
5
+ ---
6
+ # Interf Create Bias
7
+
8
+ Turn the user's requested task into a concrete compile plan the later stages can actually execute.
9
+
10
+ - treat `compile-plan.md` as the primary durable output of create; leave scaffolded `AGENTS.md` alone unless it is materially wrong
11
+ - preserve the exact requested use-case line in `compile-plan.md` instead of leaving the generic workflow placeholder
12
+ - carry named markets, years, metrics, units, comparators, and source families verbatim into the target ledger
13
+ - if the task depends on exact values from reports, PDFs, charts, or tables, require a concrete local extraction path instead of vague raw-reading language
14
+ - keep the interface bounded; do not widen into a general report summary unless a comparator or calibration anchor is genuinely needed
15
+ - for automated runs, emit these canonical status markers verbatim and on their own lines: `STATUS: loaded interface creation contract.`, `STATUS: analyzed knowledge-base.`, `STATUS: wrote compile plan.`
@@ -0,0 +1,13 @@
1
+ ---
2
+ {
3
+ "mode": "extend"
4
+ }
5
+ ---
6
+ # Interf Knowledge Base Workflow
7
+
8
+ Bias this knowledge base toward source-grounded summaries, explicit evidence tiers, and retrieval-ready compile outputs.
9
+
10
+ - keep summary titles and abstracts conservative and source-grounded
11
+ - preserve evidence tiers, truth modes, and draft-vs-final distinctions
12
+ - compile durable entities, claims, indexes, and navigation that make later interfaces easier to retrieve from
13
+ - prefer structures that help agents prove what they scanned, selected, and excluded before synthesis
@@ -0,0 +1,13 @@
1
+ ---
2
+ {
3
+ "mode": "extend"
4
+ }
5
+ ---
6
+ # Karpathy Knowledge Base Workflow
7
+
8
+ Bias this knowledge base toward the source folder -> summaries -> compiled markdown knowledge-base loop.
9
+
10
+ - keep per-source summaries legible and source-grounded
11
+ - prefer markdown-native knowledge artifacts an agent can browse and file back into the base
12
+ - preserve backlinks and local browseability across the knowledge layer
13
+ - treat the compiled base as a maintained working surface for later questions, not just a one-shot export