@interf/compiler 0.1.8
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.
- package/LICENSE +183 -0
- package/README.md +1008 -0
- package/TRADEMARKS.md +19 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +30 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/benchmark.d.ts +3 -0
- package/dist/commands/benchmark.d.ts.map +1 -0
- package/dist/commands/benchmark.js +400 -0
- package/dist/commands/benchmark.js.map +1 -0
- package/dist/commands/compile.d.ts +3 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +139 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/create.d.ts +49 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +813 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/default.d.ts +3 -0
- package/dist/commands/default.d.ts.map +1 -0
- package/dist/commands/default.js +52 -0
- package/dist/commands/default.js.map +1 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +146 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +235 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +32 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/reset.d.ts +3 -0
- package/dist/commands/reset.d.ts.map +1 -0
- package/dist/commands/reset.js +136 -0
- package/dist/commands/reset.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +67 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/verify.d.ts +3 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +112 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agents.d.ts +59 -0
- package/dist/lib/agents.d.ts.map +1 -0
- package/dist/lib/agents.js +760 -0
- package/dist/lib/agents.js.map +1 -0
- package/dist/lib/benchmark.d.ts +30 -0
- package/dist/lib/benchmark.d.ts.map +1 -0
- package/dist/lib/benchmark.js +325 -0
- package/dist/lib/benchmark.js.map +1 -0
- package/dist/lib/config.d.ts +6 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +15 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/discovery.d.ts +8 -0
- package/dist/lib/discovery.d.ts.map +1 -0
- package/dist/lib/discovery.js +80 -0
- package/dist/lib/discovery.js.map +1 -0
- package/dist/lib/executors.d.ts +33 -0
- package/dist/lib/executors.d.ts.map +1 -0
- package/dist/lib/executors.js +44 -0
- package/dist/lib/executors.js.map +1 -0
- package/dist/lib/filesystem.d.ts +4 -0
- package/dist/lib/filesystem.d.ts.map +1 -0
- package/dist/lib/filesystem.js +61 -0
- package/dist/lib/filesystem.js.map +1 -0
- package/dist/lib/interf.d.ts +37 -0
- package/dist/lib/interf.d.ts.map +1 -0
- package/dist/lib/interf.js +1104 -0
- package/dist/lib/interf.js.map +1 -0
- package/dist/lib/local-workflows.d.ts +35 -0
- package/dist/lib/local-workflows.d.ts.map +1 -0
- package/dist/lib/local-workflows.js +149 -0
- package/dist/lib/local-workflows.js.map +1 -0
- package/dist/lib/parse.d.ts +9 -0
- package/dist/lib/parse.d.ts.map +1 -0
- package/dist/lib/parse.js +51 -0
- package/dist/lib/parse.js.map +1 -0
- package/dist/lib/registry.d.ts +28 -0
- package/dist/lib/registry.d.ts.map +1 -0
- package/dist/lib/registry.js +80 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/runtime.d.ts +59 -0
- package/dist/lib/runtime.d.ts.map +1 -0
- package/dist/lib/runtime.js +615 -0
- package/dist/lib/runtime.js.map +1 -0
- package/dist/lib/schema.d.ts +705 -0
- package/dist/lib/schema.d.ts.map +1 -0
- package/dist/lib/schema.js +443 -0
- package/dist/lib/schema.js.map +1 -0
- package/dist/lib/state.d.ts +49 -0
- package/dist/lib/state.d.ts.map +1 -0
- package/dist/lib/state.js +633 -0
- package/dist/lib/state.js.map +1 -0
- package/dist/lib/summarize-plan.d.ts +16 -0
- package/dist/lib/summarize-plan.d.ts.map +1 -0
- package/dist/lib/summarize-plan.js +112 -0
- package/dist/lib/summarize-plan.js.map +1 -0
- package/dist/lib/user-config.d.ts +6 -0
- package/dist/lib/user-config.d.ts.map +1 -0
- package/dist/lib/user-config.js +16 -0
- package/dist/lib/user-config.js.map +1 -0
- package/dist/lib/validate.d.ts +149 -0
- package/dist/lib/validate.d.ts.map +1 -0
- package/dist/lib/validate.js +838 -0
- package/dist/lib/validate.js.map +1 -0
- package/dist/lib/workflow-definitions.d.ts +79 -0
- package/dist/lib/workflow-definitions.d.ts.map +1 -0
- package/dist/lib/workflow-definitions.js +565 -0
- package/dist/lib/workflow-definitions.js.map +1 -0
- package/dist/lib/workflows.d.ts +125 -0
- package/dist/lib/workflows.d.ts.map +1 -0
- package/dist/lib/workflows.js +1107 -0
- package/dist/lib/workflows.js.map +1 -0
- package/package.json +73 -0
- package/skills/benchmark/SKILL.md +129 -0
- package/skills/interface/analyze/SKILL.md +140 -0
- package/skills/interface/compile/SKILL.md +153 -0
- package/skills/interface/compile/references/output-format.md +48 -0
- package/skills/interface/create/SKILL.md +264 -0
- package/skills/interface/create/references/compile-plan-format.md +109 -0
- package/skills/interface/create/references/workflows.md +50 -0
- package/skills/interface/query/SKILL.md +34 -0
- package/skills/interface/retrieve/SKILL.md +166 -0
- package/skills/knowledge-base/compile/SKILL.md +220 -0
- package/skills/knowledge-base/compile/references/output-format.md +48 -0
- package/skills/knowledge-base/compile/references/stage-claims.md +60 -0
- package/skills/knowledge-base/compile/references/stage-entities.md +46 -0
- package/skills/knowledge-base/query/SKILL.md +33 -0
- package/skills/knowledge-base/summarize/SKILL.md +122 -0
- package/skills/workflow/create/SKILL.md +126 -0
- package/templates/interface/README.md +158 -0
- package/templates/interface/interfaces.md +99 -0
- package/templates/knowledge-base/README.md +138 -0
- package/templates/knowledge-base/interfignore +19 -0
- package/templates/knowledge-base/registry.md +118 -0
package/README.md
ADDED
|
@@ -0,0 +1,1008 @@
|
|
|
1
|
+
# Interf
|
|
2
|
+
|
|
3
|
+
The open-source knowledge compiler.
|
|
4
|
+
|
|
5
|
+
Compile any folder into an LLM knowledge base. Create interfaces for specific tasks. Run evals and benchmarks on your machine.
|
|
6
|
+
|
|
7
|
+
Interf is for skeptical builders. Most "LLM knowledge base" projects claim they work, but few make it easy to prove that on your actual task. Interf keeps your files on disk, compiles them into a knowledge base your agents can actually use, adds focused interfaces for specific jobs, and lets you benchmark what works instead of trusting marketing copy.
|
|
8
|
+
|
|
9
|
+
Interf's wedge is not "more context." It is coverage-gated retrieval: the agent should be able to prove what it scanned, what it selected, and what it excluded before it synthesizes an answer.
|
|
10
|
+
|
|
11
|
+
The deeper differentiator is benchmarkability:
|
|
12
|
+
- build multiple knowledge bases over the same folder
|
|
13
|
+
- compare workflows like `interf` vs `karpathy`
|
|
14
|
+
- compare interfaces for the same business task
|
|
15
|
+
- inspect proofs, outputs, and cost locally instead of trusting marketing claims
|
|
16
|
+
|
|
17
|
+
A useful mental model is: **Karpathy-style LLM knowledge bases plus autoresearch-style eval loops**. Interf gives you the local filesystem contract, proofs, and workflow runtime to create the knowledge base, operate interfaces on top of it, and compare methods over time.
|
|
18
|
+
|
|
19
|
+
Another useful framing:
|
|
20
|
+
|
|
21
|
+
- knowledge base = compiled shared context layer
|
|
22
|
+
- interface = task-specific knowledge surface for agents
|
|
23
|
+
- evals + benchmarks = the trust loop that tells you whether the method actually works
|
|
24
|
+
|
|
25
|
+
Architecture docs:
|
|
26
|
+
- [`docs/architecture.md`](./docs/architecture.md) — fastest way to understand the whole SDK
|
|
27
|
+
- [`docs/workflow-spec.md`](./docs/workflow-spec.md) — workflow package, compile pipeline, and stage-contract spec
|
|
28
|
+
- [`docs/runtime-contract.md`](./docs/runtime-contract.md) — exact runtime artifact contract
|
|
29
|
+
|
|
30
|
+
Doc roles:
|
|
31
|
+
- `README.md` = public human entrypoint
|
|
32
|
+
- `AGENTS.md` = maintainer and coding-agent operating guide for this repo
|
|
33
|
+
- `CLAUDE.md` = generated mirror of `AGENTS.md` for Claude Code
|
|
34
|
+
- `docs/` = deeper public technical references
|
|
35
|
+
|
|
36
|
+
## Why Interf
|
|
37
|
+
|
|
38
|
+
Most LLM knowledge-base repos optimize for a demo. Interf optimizes for proof.
|
|
39
|
+
|
|
40
|
+
- visible instructions: the compiled KB or interface folder tells the agent what to read and how to work
|
|
41
|
+
- visible proof of work: stages leave runtime state, artifacts, and coverage proof on disk
|
|
42
|
+
- visible comparison: benchmarks run on your folder so you can compare workflows and interfaces instead of trusting a claim
|
|
43
|
+
|
|
44
|
+
That is the product wedge:
|
|
45
|
+
|
|
46
|
+
- force the agent to read the right layer before it answers
|
|
47
|
+
- force the workflow to leave evidence of what happened
|
|
48
|
+
- force the method to compete on your evals
|
|
49
|
+
|
|
50
|
+
## How Interf works
|
|
51
|
+
|
|
52
|
+
1. Attach a source folder.
|
|
53
|
+
2. Compile a knowledge base over that folder.
|
|
54
|
+
3. Create one or more task-specific interfaces on top.
|
|
55
|
+
4. Run evals and benchmarks to see which workflow or interface actually performs.
|
|
56
|
+
|
|
57
|
+
## Core idea
|
|
58
|
+
|
|
59
|
+
- **Source folder**: your real files, unchanged
|
|
60
|
+
- **Knowledge base**: the living compiled layer at `./interf/{name}/`
|
|
61
|
+
- **Interface**: `./interf/{name}/interfaces/{interface-name}/`, a focused workspace on top of that knowledge base for a specific job, perspective, or workflow
|
|
62
|
+
|
|
63
|
+
The source folder is not copied into a separate managed store. It is attached in place.
|
|
64
|
+
One source folder can host multiple named knowledge bases under `./interf/` when you want to compare workflows over the same folder.
|
|
65
|
+
|
|
66
|
+
## Top 3 OSS Promises
|
|
67
|
+
|
|
68
|
+
1. Compile any folder into a structured knowledge base
|
|
69
|
+
2. Create focused interfaces for specific tasks on top of it
|
|
70
|
+
3. Define evals, run benchmarks, and pick the best workflow
|
|
71
|
+
|
|
72
|
+
That matters because Interf is designed to let you test methodology, not just store files:
|
|
73
|
+
- compare `interf` vs `karpathy` on the same folder
|
|
74
|
+
- compare multiple interfaces for the same task
|
|
75
|
+
- inspect proofs, costs, and outputs locally instead of trusting claims
|
|
76
|
+
|
|
77
|
+
This is the OSS shape of the project:
|
|
78
|
+
- local workflow engine
|
|
79
|
+
- stage-contract runtime
|
|
80
|
+
- benchmarkable filesystem contract
|
|
81
|
+
|
|
82
|
+
What Interf is really selling is not "AI knowledge" as a vibe. It is the ability to:
|
|
83
|
+
|
|
84
|
+
- compile your own folder into a structured knowledge base
|
|
85
|
+
- create task-specific interfaces on top of it
|
|
86
|
+
- define in plain English what an agent should do, then enforce that it actually happened
|
|
87
|
+
- force agents to leave proof-of-work instead of hand-waving
|
|
88
|
+
- benchmark workflows and interfaces on the same data until you find what actually performs
|
|
89
|
+
|
|
90
|
+
Simple public framing:
|
|
91
|
+
|
|
92
|
+
- source files stay in place
|
|
93
|
+
- `interf compile` compiles them into a knowledge base
|
|
94
|
+
- interfaces give you focused workspaces on top
|
|
95
|
+
- evals define what good looks like
|
|
96
|
+
- benchmarks run those evals across compiled knowledge bases or interfaces
|
|
97
|
+
|
|
98
|
+
## Design choices
|
|
99
|
+
|
|
100
|
+
- filesystem-first: the product surface is the generated folder, not a hidden service
|
|
101
|
+
- workflow packages, not magic prompts: `workflow.json` plus local docs define the method in a readable way
|
|
102
|
+
- contract-checked stages: Interf checks workspace state against the generated stage contract instead of trusting the agent summary
|
|
103
|
+
- benchmark-first: the goal is not to prove Interf is always best; the goal is to make methods explicit and comparable on your task
|
|
104
|
+
|
|
105
|
+
Manual-agent rule:
|
|
106
|
+
- open the relevant knowledge-base or interface workspace first; that is the agent entrypoint
|
|
107
|
+
- `AGENTS.md` owns the manual access checklist: what layer to check first and which higher-level artifacts must be reachable
|
|
108
|
+
- `workflow/use/query/SKILL.md` owns the exact manual query and raw-preflight procedure for that workspace
|
|
109
|
+
- use `.interf/source-access.json` to verify that raw paths are actually reachable before depending on them
|
|
110
|
+
- on the first substantive manual question, run the raw-access preflight immediately
|
|
111
|
+
- if a permission prompt is needed, ask for it immediately instead of silently staying on summaries
|
|
112
|
+
- after the preflight, start the answer with exactly `Raw access: confirmed` or `Raw access: unavailable`
|
|
113
|
+
- if sandboxing blocks raw fallback, relaunch with the source folder granted too
|
|
114
|
+
- use local `workflow/` docs to refine retrieval/output behavior without changing the engine contract
|
|
115
|
+
|
|
116
|
+
## Architecture At A Glance
|
|
117
|
+
|
|
118
|
+
Think of Interf as three visible layers:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
source-folder/ control plane, real files
|
|
122
|
+
...your files...
|
|
123
|
+
interf/
|
|
124
|
+
workflows/ reusable local workflow definitions
|
|
125
|
+
benchmarks/ reusable local benchmark specs and saved runs
|
|
126
|
+
{knowledge-base-name}/ primary local knowledge layer
|
|
127
|
+
summaries/ per-file evidence objects
|
|
128
|
+
knowledge/ cross-file knowledge layer
|
|
129
|
+
workflow/ knowledge-base method package
|
|
130
|
+
interfaces/
|
|
131
|
+
{name}/ focused workspace for one job
|
|
132
|
+
knowledge/ interface-local entities/claims
|
|
133
|
+
briefs/ hero outputs
|
|
134
|
+
summaries/ interface-local summaries
|
|
135
|
+
workflow/ interface method package
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Recommended touchpoints:
|
|
139
|
+
|
|
140
|
+
- **manage from the source folder**
|
|
141
|
+
- **browse the knowledge base** from `./interf/{name}/`
|
|
142
|
+
- **enter an interface** when you want one job-specific layer directly
|
|
143
|
+
|
|
144
|
+
## What You See In The IDE
|
|
145
|
+
|
|
146
|
+
When a user or coding agent opens an Interf knowledge base or interface, the important files should already explain the system:
|
|
147
|
+
|
|
148
|
+
- `interf.json` = what this workspace is and which workflow it uses
|
|
149
|
+
- `AGENTS.md` = the bootstrap/router for how to navigate the workspace, which workflow docs to read, and which commands matter
|
|
150
|
+
- `workflow/` = the editable local method package for this workspace
|
|
151
|
+
- `.interf/state.json` = mutable working state
|
|
152
|
+
- `.interf/health.json` = computed health and status
|
|
153
|
+
- `.interf/stage-contract.json` = the exact contract for the active stage
|
|
154
|
+
- the source folder itself usually has no generated `AGENTS.md` or `CLAUDE.md`; the KB/interface workspace is the agent entrypoint
|
|
155
|
+
|
|
156
|
+
That is the intended developer experience:
|
|
157
|
+
|
|
158
|
+
- read the markdown
|
|
159
|
+
- edit the JSON and workflow docs
|
|
160
|
+
- let Interf verify whether the stage actually completed
|
|
161
|
+
- for interfaces, start with local `workflow/use/query/`, then reuse the parent KB `workflow/use/query/` loop before raw source fallback
|
|
162
|
+
- the compiled KB/interface workspace itself is the agent-facing product surface
|
|
163
|
+
|
|
164
|
+
Two ownership rules matter:
|
|
165
|
+
|
|
166
|
+
- `workflow/`, `interf.json`, and local workflow files are user-editable
|
|
167
|
+
- `.interf/run.json` and `.interf/view-spec.json` are CLI-owned runtime artifacts
|
|
168
|
+
|
|
169
|
+
So the system should feel visible and editable without becoming ambiguous about which files are the actual referee surface.
|
|
170
|
+
|
|
171
|
+
## Instruction Hierarchy
|
|
172
|
+
|
|
173
|
+
Interf works best when the instruction layers are clear:
|
|
174
|
+
|
|
175
|
+
- `AGENTS.md` = workspace bootstrap and router
|
|
176
|
+
- `workflow/use/query/SKILL.md` = manual query loop for this workspace
|
|
177
|
+
- `workflow/compile/stages/<stage>/SKILL.md` = stage-specific compile behavior
|
|
178
|
+
- `.interf/stage-contract.json` = the current automated stage contract
|
|
179
|
+
|
|
180
|
+
For interfaces, manual query should work like this:
|
|
181
|
+
|
|
182
|
+
1. local interface query guidance
|
|
183
|
+
2. local interface artifacts
|
|
184
|
+
3. parent KB query guidance
|
|
185
|
+
4. parent KB artifacts
|
|
186
|
+
5. raw source only when needed and actually reachable
|
|
187
|
+
|
|
188
|
+
That keeps the interface layer focused instead of re-implementing parent knowledge-base policy in parallel.
|
|
189
|
+
|
|
190
|
+
Ownership rule:
|
|
191
|
+
- `AGENTS.md` = router plus first-question access checklist
|
|
192
|
+
- local `workflow/use/query/SKILL.md` = exact manual query loop for this workspace
|
|
193
|
+
- parent KB `workflow/use/query/SKILL.md` = canonical KB-wide retrieval and raw-fallback policy for interfaces
|
|
194
|
+
- compile-stage retrieval skills and `.interf/stage-contract.json` = automated stage execution, not the primary manual chat surface
|
|
195
|
+
|
|
196
|
+
These local `SKILL.md` files are workspace instruction docs. Interf routes agents to them through `AGENTS.md` and stage contracts; it does not require globally installed slash skills for the workspace method itself.
|
|
197
|
+
|
|
198
|
+
## Workflow Map
|
|
199
|
+
|
|
200
|
+
Workflows own the stage graph.
|
|
201
|
+
|
|
202
|
+
Use this terminology:
|
|
203
|
+
|
|
204
|
+
- **workflow** = the reusable method package
|
|
205
|
+
- **compile pipeline** = the ordered stage sequence inside that workflow
|
|
206
|
+
- **stage contract** = the generated acceptance boundary for the currently active stage
|
|
207
|
+
|
|
208
|
+
Built-in knowledge-base workflows currently use:
|
|
209
|
+
|
|
210
|
+
1. `summarize`
|
|
211
|
+
2. `compile`
|
|
212
|
+
|
|
213
|
+
Built-in interface workflows currently use:
|
|
214
|
+
|
|
215
|
+
1. `retrieve`
|
|
216
|
+
2. `analyze`
|
|
217
|
+
3. `compile`
|
|
218
|
+
|
|
219
|
+
Reusable local workflows can rename or split those stages. The engine still enforces the same contract kinds underneath:
|
|
220
|
+
|
|
221
|
+
- knowledge base: file-evidence stages, then knowledge-layer stages
|
|
222
|
+
- interface: retrieval stages, then analysis stages, then output stages
|
|
223
|
+
|
|
224
|
+
The executor can vary. The contract does not.
|
|
225
|
+
|
|
226
|
+
The key builder idea is:
|
|
227
|
+
|
|
228
|
+
- a workflow may define 2 stages or 10 stages
|
|
229
|
+
- each stage still maps to a known contract kind
|
|
230
|
+
- each stage may also declare additional declarative acceptance checks in `workflow.json`
|
|
231
|
+
- the generated stage contract carries the current counts, required reads, required writes, and policies for that run
|
|
232
|
+
- the CLI checks current workspace state and artifacts against that contract instead of trusting the agent's own summary
|
|
233
|
+
|
|
234
|
+
So stage acceptance is deterministic without requiring hardcoded constant numbers in the workflow itself. A stage can say "account for the current discovered source set" or "prove coverage over the current summary set" rather than "always read exactly 100 files."
|
|
235
|
+
|
|
236
|
+
Interf is also intentionally not married to one retrieval ideology. The workflow layer is where you can encode:
|
|
237
|
+
|
|
238
|
+
- summarized-knowledge workflows like the built-in `interf` and `karpathy` methods
|
|
239
|
+
- vectorless or structure-aware retrieval ideas
|
|
240
|
+
- migrated external knowledge pipelines
|
|
241
|
+
|
|
242
|
+
The product promise is not "this retrieval philosophy wins." The promise is: **make the method explicit, verify it, and benchmark it on your task.**
|
|
243
|
+
|
|
244
|
+
Product shorthand:
|
|
245
|
+
|
|
246
|
+
- source files = the folder you attached
|
|
247
|
+
- `interf compile` = the static command; the selected workflow defines the staged method underneath
|
|
248
|
+
- `knowledge/` + `home.md` = the compiled knowledge base surface
|
|
249
|
+
- interfaces = focused workspaces on top
|
|
250
|
+
|
|
251
|
+
Each knowledge base or interface records a **workflow**:
|
|
252
|
+
|
|
253
|
+
- `type` = engine object kind in config/schema (`knowledge-base` or `interface`)
|
|
254
|
+
- `workflow` = the user-facing methodology you select in the wizard
|
|
255
|
+
- reusable local workflows live under `source-folder/interf/workflows/`
|
|
256
|
+
- each reusable local workflow is defined in a readable `workflow.json` plus starter docs under `workflow/`
|
|
257
|
+
- executor = the agent/runtime that implements the active stage
|
|
258
|
+
- `compile-plan.md` = the interface's current working plan for one job
|
|
259
|
+
- local `workflow/` = the stage and query implementation you can customize
|
|
260
|
+
- `.interf/stage-contract.json` = the generated per-run contract for the active stage
|
|
261
|
+
|
|
262
|
+
That means users can change how a stage behaves, but Interf still checks the same:
|
|
263
|
+
- stage order
|
|
264
|
+
- required reads
|
|
265
|
+
- required writes
|
|
266
|
+
- runtime schema
|
|
267
|
+
- verifier surface
|
|
268
|
+
- state transitions
|
|
269
|
+
|
|
270
|
+
In practice:
|
|
271
|
+
|
|
272
|
+
- `workflow/workflow.json` + local `workflow/` docs = the method
|
|
273
|
+
- `AGENTS.md` = the navigation/bootstrap layer
|
|
274
|
+
- `.interf/stage-contract.json` = the active deterministic contract
|
|
275
|
+
- `interf verify ...` = the self-check surface for agents and tests
|
|
276
|
+
|
|
277
|
+
Rule of thumb:
|
|
278
|
+
- a workflow seeds starter local workflow docs and determines how `interf compile` is interpreted
|
|
279
|
+
- if you want different stage behavior or domain bias, use a workflow and local `workflow/`
|
|
280
|
+
- if you want a different stage graph, proof model, or required artifacts, that is effectively a new workflow
|
|
281
|
+
|
|
282
|
+
Shipped workflows:
|
|
283
|
+
- knowledge base: `interf`, `karpathy`
|
|
284
|
+
- interface:
|
|
285
|
+
- `briefing` = operator brief for what is true now, what changed, and what matters next
|
|
286
|
+
- `research` = exploratory view for themes, contradictions, and open questions
|
|
287
|
+
- `audit` = verification view for gaps, inconsistencies, and missing evidence
|
|
288
|
+
|
|
289
|
+
Local workflows:
|
|
290
|
+
- run `interf create workflow`
|
|
291
|
+
- or choose `Create new workflow...` from the workflow picker
|
|
292
|
+
- Interf saves a reusable workflow under `interf/workflows/knowledge-base/` or `interf/workflows/interface/`
|
|
293
|
+
- those saved workflows show up in the selector next time
|
|
294
|
+
|
|
295
|
+
- `.interf/stage-contract.json` = canonical stage inputs, required writes, verifier hooks, and policy
|
|
296
|
+
- `.interf/run.json` = current or last run
|
|
297
|
+
- `.interf/logs/` = per-run prompt files, status timelines, and raw agent event streams
|
|
298
|
+
- `interf verify ...` = deterministic referee
|
|
299
|
+
- `docs/workflow-spec.md` = canonical workflow/package/pipeline explanation
|
|
300
|
+
- `src/lib/schema.ts` = canonical runtime schema source of truth
|
|
301
|
+
- `src/lib/workflow-definitions.ts` = canonical public workflow registry
|
|
302
|
+
|
|
303
|
+
## What To Edit
|
|
304
|
+
|
|
305
|
+
If you want to customize how a stage works, edit local markdown files under `workflow/`.
|
|
306
|
+
Keep high-level navigation and operating guidance in `AGENTS.md`. `CLAUDE.md` is a generated mirror so Claude Code sees the same instructions automatically.
|
|
307
|
+
|
|
308
|
+
If you want to reuse the same methodology across multiple knowledge bases or interfaces in one source folder, create a reusable local workflow under `interf/workflows/` instead of copying the same `workflow/` edits around by hand.
|
|
309
|
+
|
|
310
|
+
Knowledge base:
|
|
311
|
+
|
|
312
|
+
- manual use: `workflow/use/query/SKILL.md`
|
|
313
|
+
- create-time setup: `workflow/create/SKILL.md`
|
|
314
|
+
- compile stages: `workflow/compile/stages/<stage>/SKILL.md`
|
|
315
|
+
- KB-attached interface templates: `workflow/interfaces/<interface-workflow-id>/`
|
|
316
|
+
|
|
317
|
+
Interface:
|
|
318
|
+
|
|
319
|
+
- manual use: `workflow/use/query/SKILL.md`
|
|
320
|
+
This is the interface-local query layer. When local interface artifacts are insufficient, it should defer to the parent KB query guidance at `../../workflow/use/query/SKILL.md` before any raw fallback.
|
|
321
|
+
- create-time setup: `workflow/create/SKILL.md`
|
|
322
|
+
- compile stages: `workflow/compile/stages/<stage>/SKILL.md`
|
|
323
|
+
|
|
324
|
+
Each local doc can declare:
|
|
325
|
+
|
|
326
|
+
```md
|
|
327
|
+
---
|
|
328
|
+
{
|
|
329
|
+
"mode": "extend"
|
|
330
|
+
}
|
|
331
|
+
---
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
or:
|
|
335
|
+
|
|
336
|
+
```md
|
|
337
|
+
---
|
|
338
|
+
{
|
|
339
|
+
"mode": "override"
|
|
340
|
+
}
|
|
341
|
+
---
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Meaning:
|
|
345
|
+
|
|
346
|
+
- `extend` = keep Interf's built-in stage method and add local rules
|
|
347
|
+
- `override` = replace Interf's built-in stage instructions for that stage
|
|
348
|
+
|
|
349
|
+
In both modes, Interf still enforces the same runtime schema, state flow, and verifier surface.
|
|
350
|
+
|
|
351
|
+
Workflows can also seed starter local workflow docs in `workflow/` so the customization path is visible from day one. Edit them freely; they are scaffold defaults, not protocol.
|
|
352
|
+
|
|
353
|
+
## Quick start
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
npm install -g @interf/compiler
|
|
357
|
+
|
|
358
|
+
# or install from source while contributing:
|
|
359
|
+
git clone https://github.com/interf-labs/interf.git
|
|
360
|
+
cd interf && npm install
|
|
361
|
+
npm install -g .
|
|
362
|
+
|
|
363
|
+
interf init
|
|
364
|
+
|
|
365
|
+
mkdir -p ~/my-notes
|
|
366
|
+
# put files into ~/my-notes however you want
|
|
367
|
+
|
|
368
|
+
cd ~/my-notes
|
|
369
|
+
interf create knowledge-base
|
|
370
|
+
interf compile
|
|
371
|
+
|
|
372
|
+
cd interf/my-notes
|
|
373
|
+
# open in Obsidian here
|
|
374
|
+
# for manual coding-agent sessions, stay at ~/my-notes and point the agent at ./interf/my-notes
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Create an interface later:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
cd ~/my-notes
|
|
381
|
+
interf create interface
|
|
382
|
+
interf compile
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
`interf compile` is the primary flow. It auto-detects whether you are in a source folder, a knowledge base, or an interface.
|
|
386
|
+
|
|
387
|
+
## User flow
|
|
388
|
+
|
|
389
|
+
### 1. Set up Interf globally
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
interf init
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
This chooses your default executor, optionally installs global helper skills for manual use, and optionally enables Obsidian-friendly defaults. Local workspaces and bundled stage instructions remain authoritative either way.
|
|
396
|
+
If you run it inside a normal folder, the wizard can also attach that folder as a knowledge base and immediately compile it.
|
|
397
|
+
|
|
398
|
+
### 2. Attach Interf to any folder as a knowledge base
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
cd ~/my-notes
|
|
402
|
+
interf create knowledge-base
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
The wizard records:
|
|
406
|
+
|
|
407
|
+
- the selected knowledge-base workflow in `interf.json`
|
|
408
|
+
- any starter local workflow docs seeded by that workflow
|
|
409
|
+
|
|
410
|
+
Interf creates:
|
|
411
|
+
|
|
412
|
+
```text
|
|
413
|
+
my-notes/
|
|
414
|
+
...your files...
|
|
415
|
+
interf/
|
|
416
|
+
my-notes/
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Recommended touchpoint:
|
|
420
|
+
|
|
421
|
+
- manage from the source folder
|
|
422
|
+
- browse from `./interf/{name}/`
|
|
423
|
+
- drop into an interface folder only when you want its local outputs directly
|
|
424
|
+
|
|
425
|
+
### 3. Compile the knowledge base
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
interf compile
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Knowledge-base compilation has two steps:
|
|
432
|
+
|
|
433
|
+
1. Summarize source files into source-grounded evidence objects in `summaries/`
|
|
434
|
+
2. Compile the cross-file knowledge base in `knowledge/` and `home.md`
|
|
435
|
+
|
|
436
|
+
### 4. Create interfaces when you need a focused workspace for a specific job
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
cd ~/my-notes
|
|
440
|
+
interf create interface
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
Interfaces live inside the main knowledge base:
|
|
444
|
+
|
|
445
|
+
```text
|
|
446
|
+
my-notes/
|
|
447
|
+
interf/
|
|
448
|
+
my-notes/
|
|
449
|
+
interfaces/
|
|
450
|
+
weekly-briefing/
|
|
451
|
+
research-synthesis/
|
|
452
|
+
gap-audit/
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
Each interface has its own `interf.json`, `AGENTS.md`, `CLAUDE.md`, `compile-plan.md`, `home.md`, runtime state, local workflow package, and local outputs.
|
|
456
|
+
|
|
457
|
+
Recommended flow:
|
|
458
|
+
|
|
459
|
+
- create interfaces from the source folder
|
|
460
|
+
- let the wizard compile them immediately when possible
|
|
461
|
+
- browse them from the parent knowledge-base vault or by opening `interfaces/{name}/home.md`
|
|
462
|
+
|
|
463
|
+
## Directory layout
|
|
464
|
+
|
|
465
|
+
### Knowledge base
|
|
466
|
+
|
|
467
|
+
```text
|
|
468
|
+
source-folder/
|
|
469
|
+
...user files...
|
|
470
|
+
interf/
|
|
471
|
+
workflows/
|
|
472
|
+
benchmarks/
|
|
473
|
+
{knowledge-base-name}/
|
|
474
|
+
interf.json
|
|
475
|
+
AGENTS.md
|
|
476
|
+
CLAUDE.md
|
|
477
|
+
home.md
|
|
478
|
+
.interfignore
|
|
479
|
+
.gitignore
|
|
480
|
+
.interf/
|
|
481
|
+
state.json
|
|
482
|
+
health.json
|
|
483
|
+
view-spec.json
|
|
484
|
+
source-access.json
|
|
485
|
+
run.json
|
|
486
|
+
run-history.jsonl
|
|
487
|
+
stage-contract.json
|
|
488
|
+
summarize-targets.json
|
|
489
|
+
inventory.json
|
|
490
|
+
workflow/
|
|
491
|
+
workflow.json
|
|
492
|
+
README.md
|
|
493
|
+
create/
|
|
494
|
+
SKILL.md
|
|
495
|
+
compile/
|
|
496
|
+
stages/
|
|
497
|
+
{workflow-stage-1}/
|
|
498
|
+
{workflow-stage-2}/
|
|
499
|
+
use/
|
|
500
|
+
query/
|
|
501
|
+
SKILL.md
|
|
502
|
+
interfaces/
|
|
503
|
+
{interface-workflow-id}/
|
|
504
|
+
summaries/
|
|
505
|
+
knowledge/
|
|
506
|
+
entities/
|
|
507
|
+
claims/
|
|
508
|
+
indexes/
|
|
509
|
+
interfaces/
|
|
510
|
+
{name}/
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### Interface (engine type: `interface`)
|
|
514
|
+
|
|
515
|
+
```text
|
|
516
|
+
source-folder/
|
|
517
|
+
interf/
|
|
518
|
+
{knowledge-base-name}/
|
|
519
|
+
interfaces/
|
|
520
|
+
{name}/
|
|
521
|
+
interf.json
|
|
522
|
+
compile-plan.md
|
|
523
|
+
AGENTS.md
|
|
524
|
+
CLAUDE.md
|
|
525
|
+
home.md
|
|
526
|
+
.gitignore
|
|
527
|
+
.interf/
|
|
528
|
+
state.json
|
|
529
|
+
health.json
|
|
530
|
+
view-spec.json
|
|
531
|
+
run.json
|
|
532
|
+
run-history.jsonl
|
|
533
|
+
stage-contract.json
|
|
534
|
+
relevant.json
|
|
535
|
+
coverage.json
|
|
536
|
+
analysis.json
|
|
537
|
+
workflow/
|
|
538
|
+
workflow.json
|
|
539
|
+
README.md
|
|
540
|
+
create/
|
|
541
|
+
SKILL.md
|
|
542
|
+
compile/
|
|
543
|
+
stages/
|
|
544
|
+
{workflow-stage-1}/
|
|
545
|
+
{workflow-stage-2}/
|
|
546
|
+
{workflow-stage-3}/
|
|
547
|
+
use/
|
|
548
|
+
query/
|
|
549
|
+
SKILL.md
|
|
550
|
+
knowledge/
|
|
551
|
+
entities/
|
|
552
|
+
claims/
|
|
553
|
+
briefs/
|
|
554
|
+
summaries/
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
## Config
|
|
558
|
+
|
|
559
|
+
### Knowledge-Base `interf.json`
|
|
560
|
+
|
|
561
|
+
Knowledge bases use the internal engine type `knowledge-base` in `interf.json` and runtime schemas.
|
|
562
|
+
|
|
563
|
+
```json
|
|
564
|
+
{
|
|
565
|
+
"type": "knowledge-base",
|
|
566
|
+
"name": "my-notes",
|
|
567
|
+
"workflow": "interf",
|
|
568
|
+
"source": {
|
|
569
|
+
"path": "../.."
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### Interface `interf.json`
|
|
575
|
+
|
|
576
|
+
```json
|
|
577
|
+
{
|
|
578
|
+
"type": "interface",
|
|
579
|
+
"name": "weekly-briefing",
|
|
580
|
+
"workflow": "briefing",
|
|
581
|
+
"knowledge_base": {
|
|
582
|
+
"path": "../.."
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
- Knowledge-base config points to the source folder with `source.path`
|
|
588
|
+
- Interface config points to the main knowledge base with `knowledge_base.path`
|
|
589
|
+
- `workflow` records the selected methodology
|
|
590
|
+
- Processing logic stays out of config
|
|
591
|
+
- Interface-specific planning lives in `compile-plan.md`
|
|
592
|
+
- Local stage and query implementation lives in `workflow/`
|
|
593
|
+
- `AGENTS.md` is the source of truth for agent bootstrap instructions
|
|
594
|
+
- `CLAUDE.md` is a generated mirror of `AGENTS.md` so Claude Code gets the same knowledge-base instructions automatically
|
|
595
|
+
- `.interf/source-access.json` is the quick-check surface for raw-file accessibility in manual agent sessions
|
|
596
|
+
- `workflow/` holds repo-local instruction docs for create, compile stages, and manual use
|
|
597
|
+
- local `workflow/.../SKILL.md` files are workspace docs, not required global slash skills
|
|
598
|
+
- generated `AGENTS.md` / `CLAUDE.md` live in knowledge bases and interfaces, not the source root
|
|
599
|
+
- local docs can declare `mode: extend` or `mode: override` in JSON frontmatter
|
|
600
|
+
- Interf still guarantees the runtime schema, required writes, verifiers, and state flow even when stage logic is overridden
|
|
601
|
+
|
|
602
|
+
## Instruction + Enforcement Model
|
|
603
|
+
|
|
604
|
+
Interf separates:
|
|
605
|
+
|
|
606
|
+
- **workflow** — the methodology that defines what `interf compile` means for this knowledge base or interface
|
|
607
|
+
- **stage contract** — the generated per-run file with fixed inputs, outputs, required proofs, and state expectations
|
|
608
|
+
- **instructions** — flexible markdown docs that tell an executor how to satisfy that contract
|
|
609
|
+
- **enforcement** — deterministic checks that decide whether the stage actually complied
|
|
610
|
+
- **executor** — Claude Code, Codex, API-backed runner, or your own managed process
|
|
611
|
+
|
|
612
|
+
That means:
|
|
613
|
+
|
|
614
|
+
- executors are swappable
|
|
615
|
+
- auth belongs to the executor
|
|
616
|
+
- local stage logic is customizable in files
|
|
617
|
+
- Interf enforces compliance at runtime by checking workspace state and required artifacts against the stage contract
|
|
618
|
+
|
|
619
|
+
This is the practical "agents do not get to freestyle" layer:
|
|
620
|
+
|
|
621
|
+
- `AGENTS.md` tells the agent how to enter and navigate the workspace
|
|
622
|
+
- query docs under `workflow/use/query/` tell the agent how to use the compiled KB or interface
|
|
623
|
+
- stage docs under `workflow/compile/stages/` tell the agent how to perform a specific stage
|
|
624
|
+
- the CLI writes `.interf/stage-contract.json` so the executor knows exactly what must be read, written, proved, and left on disk for the current run
|
|
625
|
+
- `.interf/state.json`, `.interf/health.json`, and required stage files show what the agent scanned, selected, analyzed, and wrote
|
|
626
|
+
- deterministic checks decide pass/fail from that runtime state instead of trusting the agent's own summary of its work
|
|
627
|
+
|
|
628
|
+
That is the proof-of-work story. Interf is not just prompts. It is prompts plus contracts plus enforcement plus persisted traces.
|
|
629
|
+
|
|
630
|
+
Workflow doc modes:
|
|
631
|
+
|
|
632
|
+
- `mode: extend` — add local stage rules on top of bundled Interf instructions
|
|
633
|
+
- `mode: override` — replace bundled stage instructions for that stage
|
|
634
|
+
|
|
635
|
+
In both modes, Interf still requires the same artifact schema and flow.
|
|
636
|
+
|
|
637
|
+
## CLI commands
|
|
638
|
+
|
|
639
|
+
Human-facing workflow:
|
|
640
|
+
|
|
641
|
+
```text
|
|
642
|
+
interf init
|
|
643
|
+
interf create knowledge-base
|
|
644
|
+
interf create interface
|
|
645
|
+
interf compile [type]
|
|
646
|
+
interf benchmark [type]
|
|
647
|
+
interf doctor [--live]
|
|
648
|
+
interf list
|
|
649
|
+
interf status
|
|
650
|
+
interf reset <scope>
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
Command notes:
|
|
654
|
+
|
|
655
|
+
- `interf init` handles global setup first; if you run it inside a normal folder, the wizard can also attach and compile a knowledge base there
|
|
656
|
+
- `interf create` opens a chooser when you do not pass a type
|
|
657
|
+
- `interf create knowledge-base` attaches the current folder as a knowledge base, then lets you choose an existing workflow or create a new reusable local workflow
|
|
658
|
+
- `interf create interface` creates a focused interface for the current folder's knowledge base, then lets you choose an existing workflow or create a new reusable local workflow
|
|
659
|
+
- `interf compile` is the primary public verb, auto-detects knowledge base vs interface, and now runs executor preflight automatically before work starts
|
|
660
|
+
- `interf benchmark` compares already-compiled knowledge bases or interfaces using a file-based benchmark spec under `interf/benchmarks/`
|
|
661
|
+
- `interf doctor` checks local executor setup; `--live` exercises the actual configured agent directly when you want to inspect it yourself
|
|
662
|
+
- `interf status` is deterministic and read-only
|
|
663
|
+
- manual query/use is part of the compiled workspace protocol: open the KB/interface folder, read `AGENTS.md`, then follow `workflow/use/query/SKILL.md`
|
|
664
|
+
|
|
665
|
+
## Evals And Benchmarks
|
|
666
|
+
|
|
667
|
+
`interf benchmark` assumes the selected knowledge bases or interfaces are already compiled.
|
|
668
|
+
|
|
669
|
+
V1 intentionally stays simple:
|
|
670
|
+
|
|
671
|
+
- eval files are human-owned files on disk
|
|
672
|
+
- cases describe what must be true in plain English
|
|
673
|
+
- Interf checks deterministic file outputs instead of using an LLM judge by default
|
|
674
|
+
- if a target is not compiled, it should not be benchmark-eligible
|
|
675
|
+
|
|
676
|
+
The benchmark input is a small local file under:
|
|
677
|
+
|
|
678
|
+
- `interf/benchmarks/knowledge-base/*.json`
|
|
679
|
+
- `interf/benchmarks/interface/*.json`
|
|
680
|
+
|
|
681
|
+
Interf writes benchmark run artifacts under:
|
|
682
|
+
|
|
683
|
+
- `interf/benchmarks/runs/knowledge-base/*.json`
|
|
684
|
+
- `interf/benchmarks/runs/interface/*.json`
|
|
685
|
+
|
|
686
|
+
Minimal example:
|
|
687
|
+
|
|
688
|
+
```json
|
|
689
|
+
{
|
|
690
|
+
"type": "knowledge-base",
|
|
691
|
+
"name": "Home Quality",
|
|
692
|
+
"description": "Check that home.md surfaces the main themes clearly.",
|
|
693
|
+
"cases": [
|
|
694
|
+
{
|
|
695
|
+
"id": "home-overview",
|
|
696
|
+
"question": "Does home.md explain the main themes and next steps?",
|
|
697
|
+
"file": "home.md",
|
|
698
|
+
"expect": {
|
|
699
|
+
"must_include": ["main themes", "next steps"],
|
|
700
|
+
"must_not_include": ["TODO"],
|
|
701
|
+
"min_words": 80
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
]
|
|
705
|
+
}
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
Why this format:
|
|
709
|
+
|
|
710
|
+
- the `question` stays plain English and easy to edit
|
|
711
|
+
- the checks stay deterministic and local
|
|
712
|
+
- the same file works for knowledge-base or interface comparisons
|
|
713
|
+
- users can understand and modify it without learning a custom benchmark DSL
|
|
714
|
+
|
|
715
|
+
Product split:
|
|
716
|
+
|
|
717
|
+
- `eval` = the criteria file you define
|
|
718
|
+
- `benchmark` = running those evals across compiled knowledge bases or interfaces
|
|
719
|
+
|
|
720
|
+
The benchmark wizard only offers targets whose current status is `compiled`, so stale or failed targets are visible but not benchmark-eligible.
|
|
721
|
+
|
|
722
|
+
Why not prompt-plus-expected-answer first:
|
|
723
|
+
|
|
724
|
+
- exact-answer evals are brittle
|
|
725
|
+
- LLM-judge loops add cost and ambiguity too early
|
|
726
|
+
- artifact checks keep the system inspectable and reproducible
|
|
727
|
+
|
|
728
|
+
Future versions can add query-based evals, but the default should stay file-first and understandable.
|
|
729
|
+
|
|
730
|
+
Agent/test harness command:
|
|
731
|
+
|
|
732
|
+
```text
|
|
733
|
+
interf verify <check>
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
- `interf verify <check> --json` is mainly for agents, tests, and internal harness checks
|
|
737
|
+
- it exists so agents can call stable deterministic validators via the CLI instead of writing custom verification code
|
|
738
|
+
|
|
739
|
+
## How compile works
|
|
740
|
+
|
|
741
|
+
### Knowledge-base compile
|
|
742
|
+
|
|
743
|
+
`interf compile` in a knowledge base runs the selected workflow's stage graph.
|
|
744
|
+
|
|
745
|
+
Built-in workflows currently use:
|
|
746
|
+
|
|
747
|
+
1. `knowledge-base/summarize`
|
|
748
|
+
- bundled file-evidence contract
|
|
749
|
+
- discovers source files from `source.path`
|
|
750
|
+
- compares them to `summaries/`
|
|
751
|
+
- writes or updates one summary per source file
|
|
752
|
+
2. `knowledge-base/compile`
|
|
753
|
+
- bundled knowledge-layer contract
|
|
754
|
+
- scans all files in `summaries/`
|
|
755
|
+
- turns those summaries into the local LLM wiki layer
|
|
756
|
+
- builds `knowledge/` with summaries, backlinks, concepts, and linked articles
|
|
757
|
+
- updates `home.md`
|
|
758
|
+
|
|
759
|
+
Custom workflows can split or rename those stages, but they still have to satisfy the file-evidence then knowledge-layer pipeline.
|
|
760
|
+
|
|
761
|
+
### Interface compile
|
|
762
|
+
|
|
763
|
+
`interf compile` in an interface runs the selected workflow's stage graph.
|
|
764
|
+
|
|
765
|
+
Built-in workflows currently use:
|
|
766
|
+
|
|
767
|
+
1. `interface/retrieve`
|
|
768
|
+
- bundled retrieval contract
|
|
769
|
+
- scans all knowledge-base `summaries/` frontmatter
|
|
770
|
+
- reviews candidate abstracts and expands through links when needed
|
|
771
|
+
- selects the relevant set with proof of coverage
|
|
772
|
+
- saves `.interf/relevant.json`
|
|
773
|
+
- saves `.interf/coverage.json`
|
|
774
|
+
2. `interface/analyze`
|
|
775
|
+
- bundled analysis contract
|
|
776
|
+
- analyzes the relevant set
|
|
777
|
+
- extracts interface-local entities and claims
|
|
778
|
+
- writes temporary analysis artifacts
|
|
779
|
+
3. `interface/compile`
|
|
780
|
+
- bundled output contract
|
|
781
|
+
- writes local `knowledge/`, `briefs/`, `summaries/`, and `home.md`
|
|
782
|
+
|
|
783
|
+
Custom workflows can split or rename those stages, but they still have to satisfy the retrieval then analysis then output pipeline.
|
|
784
|
+
|
|
785
|
+
Each stage is resumable via durable runtime artifacts:
|
|
786
|
+
- `.interf/state.json` for long-lived summary state
|
|
787
|
+
- `.interf/run.json` for the active or most recent deterministic stage run
|
|
788
|
+
- `.interf/stage-contract.json` for the machine-readable contract the current stage must follow
|
|
789
|
+
- `.interf/run-history.jsonl` for prior completed runs
|
|
790
|
+
- `.interf/logs/` for prompt, status, and raw agent traces from automated runs
|
|
791
|
+
|
|
792
|
+
## Status and runtime files
|
|
793
|
+
|
|
794
|
+
Runtime state lives under `.interf/` and is gitignored.
|
|
795
|
+
|
|
796
|
+
Important files:
|
|
797
|
+
|
|
798
|
+
- `.interf/state.json`: stage completion, timestamps, counts
|
|
799
|
+
- `.interf/health.json`: computed health and trust surface
|
|
800
|
+
- `.interf/view-spec.json`: viewer-neutral card and graph contract
|
|
801
|
+
- `.interf/run.json`: current or last stage run, with stage, executor, timestamps, counts, and status
|
|
802
|
+
- `.interf/stage-contract.json`: machine-readable stage contract for the active run
|
|
803
|
+
- `.interf/run-history.jsonl`: append-only history of completed or failed runs
|
|
804
|
+
- `.interf/logs/`: one prompt file, one status timeline, and one raw event stream per automated run for later analysis
|
|
805
|
+
- `.interf/relevant.json`: retrieved set for interfaces
|
|
806
|
+
- `.interf/coverage.json`: retrieval proof for interfaces
|
|
807
|
+
- `.interf/analysis.json`: temporary interface analysis handoff
|
|
808
|
+
|
|
809
|
+
`interf status` computes health from filesystem facts plus runtime state. It does not require a live executor run.
|
|
810
|
+
|
|
811
|
+
Ownership rule:
|
|
812
|
+
|
|
813
|
+
- agents may read `.interf/run.json` and `.interf/view-spec.json`
|
|
814
|
+
- the CLI owns writing and normalizing them
|
|
815
|
+
- local workflow docs should update `state.json` and required stage artifacts, not rewrite the run ledger or viewer contract
|
|
816
|
+
|
|
817
|
+
For the exact schema:
|
|
818
|
+
|
|
819
|
+
- human-readable contract: [docs/runtime-contract.md](/Users/gedossman/Documents/interf/interf-brain-sdk/docs/runtime-contract.md)
|
|
820
|
+
- TypeScript source of truth: [src/lib/schema.ts](/Users/gedossman/Documents/interf/interf-brain-sdk/src/lib/schema.ts)
|
|
821
|
+
|
|
822
|
+
## Validation and testing
|
|
823
|
+
|
|
824
|
+
For repo-level regression coverage:
|
|
825
|
+
|
|
826
|
+
```bash
|
|
827
|
+
npm test
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
For a real local acceptance run against your configured coding agent:
|
|
831
|
+
|
|
832
|
+
```bash
|
|
833
|
+
npm run test:acceptance-live
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
That live acceptance runner:
|
|
837
|
+
|
|
838
|
+
- creates a temp source folder with a small real fixture
|
|
839
|
+
- creates one `interf` knowledge base on it
|
|
840
|
+
- asserts the KB scaffold files exist exactly where Interf says they should
|
|
841
|
+
- compiles it with the real configured local executor
|
|
842
|
+
- asserts KB outputs, proofs, run ledgers, and logs exist after compile
|
|
843
|
+
- creates and compiles one briefing interface on top
|
|
844
|
+
- asserts interface scaffold files, retrieve proof, outputs, run ledgers, and logs exist
|
|
845
|
+
- runs a manual KB query exercise from the compiled folder and saves trace files under `.interf/query-acceptance/`
|
|
846
|
+
- runs a manual interface query exercise that must go local interface -> parent KB -> raw source and saves the resulting traces and status logs
|
|
847
|
+
- prints the temp folder path so you can inspect real outputs
|
|
848
|
+
|
|
849
|
+
For the heavier workflow-comparison path:
|
|
850
|
+
|
|
851
|
+
```bash
|
|
852
|
+
npm run test:acceptance-compare
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
That compare mode spins up both `interf` and `karpathy`, compiles interfaces on top, and saves benchmark runs.
|
|
856
|
+
|
|
857
|
+
For the heavier scenario matrix:
|
|
858
|
+
|
|
859
|
+
```bash
|
|
860
|
+
npm run test:acceptance-matrix
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
That matrix mode:
|
|
864
|
+
|
|
865
|
+
- creates two KBs on the same source folder: `interf` and `karpathy`
|
|
866
|
+
- compiles both KBs and validates their scaffolds, outputs, proofs, and logs
|
|
867
|
+
- creates multiple interface workflows on top of each KB: `briefing`, `research`, `audit`
|
|
868
|
+
- compiles all of them with the real executor
|
|
869
|
+
- runs file-based benchmarks across the compiled KBs and interfaces
|
|
870
|
+
- keeps the temp folder so you can inspect the exact artifact tree and `.interf/logs/`
|
|
871
|
+
|
|
872
|
+
Current limitation:
|
|
873
|
+
|
|
874
|
+
- benchmark/eval runs still score compiled outputs on disk
|
|
875
|
+
- query/use traversal is now covered by the live acceptance runner, but not yet by the file-based benchmark runner
|
|
876
|
+
- if we want query-mode evals next, that should be a separate harness layer, not hidden inside the current file-based benchmark runner
|
|
877
|
+
|
|
878
|
+
Add `--cleanup` if you want a successful run removed afterward:
|
|
879
|
+
|
|
880
|
+
```bash
|
|
881
|
+
node scripts/acceptance-live.mjs --cleanup
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
For internal executor/model checks without changing your saved default agent:
|
|
885
|
+
|
|
886
|
+
```bash
|
|
887
|
+
node scripts/acceptance-live.mjs --agent codex --model gpt-5-codex
|
|
888
|
+
node scripts/acceptance-live.mjs --agent claude-code --effort low
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
For fast targeted reruns against a cached real fixture:
|
|
892
|
+
|
|
893
|
+
```bash
|
|
894
|
+
npm run test:acceptance-cache:refresh
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
That refresh command reruns the real quick acceptance flow and saves the latest compiled source folder at `.interf-test-cache/latest-quick/`.
|
|
898
|
+
|
|
899
|
+
After that, use the targeted quick checks:
|
|
900
|
+
|
|
901
|
+
```bash
|
|
902
|
+
npm run test:acceptance-quick:create-interface
|
|
903
|
+
npm run test:acceptance-quick:query-interface
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
Those quick checks copy the cached fixture to a temp folder and rerun only one focused path:
|
|
907
|
+
|
|
908
|
+
- `create-interface` = start from a precompiled KB and rerun the real interface-create stage logic without rebuilding the KB first
|
|
909
|
+
- `query-interface` = rerun the manual interface query chain (`local interface -> parent KB -> raw`)
|
|
910
|
+
|
|
911
|
+
Recommended dev loop:
|
|
912
|
+
|
|
913
|
+
1. Use the quick targeted scripts while iterating on one stage or one narrow user flow.
|
|
914
|
+
2. After a meaningful runtime or scaffolding change, refresh the cached fixture with `npm run test:acceptance-cache:refresh`.
|
|
915
|
+
3. After bigger changes, rerun the full live acceptance and compare/matrix flows.
|
|
916
|
+
|
|
917
|
+
For agent/test harness work, use `interf status` plus `interf verify <check> --json` as needed. The exact built-in check names are implementation details of the current referee layer.
|
|
918
|
+
|
|
919
|
+
Recommended human workflow:
|
|
920
|
+
|
|
921
|
+
1. `interf create interface`
|
|
922
|
+
2. `interf compile`
|
|
923
|
+
3. inspect `home.md` and `interf status`
|
|
924
|
+
4. only then continue to higher-level QA of the interface outputs
|
|
925
|
+
|
|
926
|
+
Recommended agent/testing workflow:
|
|
927
|
+
|
|
928
|
+
1. `interf create interface`
|
|
929
|
+
2. `interf verify interface-plan --json`
|
|
930
|
+
3. `interf compile`
|
|
931
|
+
4. `interf verify retrieve --json`
|
|
932
|
+
5. inspect `home.md`, `.interf/health.json`, `.interf/relevant.json`, and `.interf/coverage.json`
|
|
933
|
+
|
|
934
|
+
## Obsidian
|
|
935
|
+
|
|
936
|
+
Obsidian is optional.
|
|
937
|
+
|
|
938
|
+
If you enable viewer defaults during `interf init`, Interf:
|
|
939
|
+
|
|
940
|
+
- writes minimal `.obsidian/graph.json` defaults
|
|
941
|
+
- attempts to register the knowledge base with Obsidian
|
|
942
|
+
|
|
943
|
+
It does **not** rely on Obsidian for runtime logic, and it no longer auto-opens vaults via URI. If the running Obsidian app does not show a newly created knowledge base immediately, restart Obsidian or add the folder once through `Manage vaults`.
|
|
944
|
+
|
|
945
|
+
Important: Obsidian labels vaults by the registered folder name. With the named knowledge-base contract, the registered folder is `interf/{name}/`, so Obsidian will usually show that knowledge-base name directly.
|
|
946
|
+
|
|
947
|
+
Open this folder in Obsidian:
|
|
948
|
+
|
|
949
|
+
- knowledge base: `source-folder/interf/{name}`
|
|
950
|
+
|
|
951
|
+
Do **not** rely on standalone interface vaults by default. Interfaces live inside the knowledge base and need access to parent `summaries/` and source links. Browse them from the knowledge-base vault at `interfaces/{name}/`.
|
|
952
|
+
|
|
953
|
+
For sandboxed coding agents, the executor should grant access to both the source folder and the knowledge-base tree. Launching an agent from the knowledge-base directory alone can hide raw files referenced through `source.path`.
|
|
954
|
+
|
|
955
|
+
For manual agent sessions, the default entrypoint is the relevant knowledge-base or interface workspace. If raw-file fallback is blocked, relaunch with the source folder granted too.
|
|
956
|
+
|
|
957
|
+
Touchpoints:
|
|
958
|
+
|
|
959
|
+
- source folder = CLI control plane and raw-access parent when needed
|
|
960
|
+
- knowledge-base root = default semantic/manual session root with Interf bootstrap docs
|
|
961
|
+
- interface root = focused manual session root for one use case
|
|
962
|
+
- `./interf/` = namespace container, not the main session root
|
|
963
|
+
|
|
964
|
+
In the retrieval proof:
|
|
965
|
+
|
|
966
|
+
- `proof.scanned` is the full set of knowledge-base summaries scanned at the frontmatter-routing layer
|
|
967
|
+
- `proof.reviewed` is the smaller set of candidate summaries whose abstracts were actually reviewed before selection
|
|
968
|
+
- `proof.retrieved` and `proof.excluded` must partition that scanned summary set before analyze begins
|
|
969
|
+
|
|
970
|
+
## Naming and retrieval
|
|
971
|
+
|
|
972
|
+
Interf uses:
|
|
973
|
+
|
|
974
|
+
- **prose-as-title**: filenames are readable claims, not slugs
|
|
975
|
+
- **wiki-link-as-prose**: links read as sentences
|
|
976
|
+
- **progressive disclosure**: title → frontmatter → abstract → overview → source file
|
|
977
|
+
|
|
978
|
+
Agents should start in `home.md`, move into `knowledge/`, then fall back to `summaries/`, and only open source files when needed.
|
|
979
|
+
|
|
980
|
+
## Bring files in
|
|
981
|
+
|
|
982
|
+
Primary model:
|
|
983
|
+
|
|
984
|
+
- put files directly into the source folder
|
|
985
|
+
- run `interf compile`
|
|
986
|
+
|
|
987
|
+
Interf treats the folder itself as the source of truth. Bring files in however you want:
|
|
988
|
+
- save/export them directly into the folder
|
|
989
|
+
- clip articles into markdown
|
|
990
|
+
- download related images locally when they matter for context
|
|
991
|
+
|
|
992
|
+
For web content, markdown clips plus local images work especially well because the resulting knowledge base stays easy for agents to navigate and cite.
|
|
993
|
+
|
|
994
|
+
## Principles
|
|
995
|
+
|
|
996
|
+
- Local-first
|
|
997
|
+
- Source folder stays untouched by compile
|
|
998
|
+
- One visible `interf/{name}/` knowledge base per source folder
|
|
999
|
+
- No duplicated raw store by default
|
|
1000
|
+
- Any coding agent
|
|
1001
|
+
- Obsidian is a viewer, not a dependency
|
|
1002
|
+
- Registry is convenience only; local `interf.json` files are the durable source of truth
|
|
1003
|
+
|
|
1004
|
+
## License
|
|
1005
|
+
|
|
1006
|
+
Interf SDK is licensed under Apache 2.0. See [LICENSE](./LICENSE).
|
|
1007
|
+
|
|
1008
|
+
The `Interf` name and related branding are reserved by Interf, Inc. See [TRADEMARKS.md](./TRADEMARKS.md).
|