@interf/compiler 0.1.8 → 0.1.10

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 (2) hide show
  1. package/README.md +134 -886
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -2,471 +2,127 @@
2
2
 
3
3
  The open-source knowledge compiler.
4
4
 
5
- Compile any folder into an LLM knowledge base. Create interfaces for specific tasks. Run evals and benchmarks on your machine.
5
+ Interf is a filesystem-first system for building, testing, and comparing agent-ready knowledge structures.
6
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.
7
+ - compile any folder into a knowledge base
8
+ - create focused interfaces for specific tasks
9
+ - run evals and benchmarks on your own files
8
10
 
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
11
+ Most LLM knowledge-base repos optimize for a demo. Interf optimizes for proof. It keeps your files on disk, compiles a visible folder an agent can actually use, and makes workflows compete on your evals instead of on marketing claims.
35
12
 
36
13
  ## Why Interf
37
14
 
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`
15
+ Interf is built around three ideas:
218
16
 
219
- Reusable local workflows can rename or split those stages. The engine still enforces the same contract kinds underneath:
17
+ - the product surface is the compiled folder, not a hidden service
18
+ - the workflow should leave proof of work on disk
19
+ - the method should be benchmarkable on your task
220
20
 
221
- - knowledge base: file-evidence stages, then knowledge-layer stages
222
- - interface: retrieval stages, then analysis stages, then output stages
21
+ That gives you a simple loop:
223
22
 
224
- The executor can vary. The contract does not.
23
+ 1. point Interf at a folder
24
+ 2. compile a knowledge base
25
+ 3. create an interface for a job
26
+ 4. run evals and benchmarks to see what actually works
225
27
 
226
- The key builder idea is:
28
+ ## Core concepts
227
29
 
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
30
+ - **Source folder**: your real files stay where they are
31
+ - **Knowledge base**: `interf/{name}/`, the shared compiled layer over that folder
32
+ - **Interface**: `interf/{name}/interfaces/{interface-name}/`, a focused workspace on top of one knowledge base
33
+ - **Workflow**: the reusable method package that defines the compile pipeline
34
+ - **Benchmark**: running evals across compiled knowledge bases or interfaces on the same folder
233
35
 
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."
36
+ One source folder can host multiple knowledge bases under `interf/` when you want to compare workflows like `interf` vs `karpathy` on the same data.
235
37
 
236
- Interf is also intentionally not married to one retrieval ideology. The workflow layer is where you can encode:
38
+ ## Interf primitives
237
39
 
238
- - summarized-knowledge workflows like the built-in `interf` and `karpathy` methods
239
- - vectorless or structure-aware retrieval ideas
240
- - migrated external knowledge pipelines
40
+ Interf gives you a few strong primitives instead of a giant abstraction layer:
241
41
 
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.**
42
+ - **workflow package**: `workflow.json` plus local `workflow/` docs define the method
43
+ - **stage contract**: every compile stage gets a deterministic acceptance boundary
44
+ - **declarative acceptance**: workflows can declare extra acceptance rules in `workflow.json`
45
+ - **CLI enforcement**: the CLI checks whether a stage actually complied instead of trusting the agent's summary
46
+ - **benchmark specs**: file-based evals let you compare workflows and interfaces on the same folder
243
47
 
244
- Product shorthand:
48
+ That is the core product promise:
245
49
 
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
50
+ - define what the agent should do in plain English
51
+ - give the agent local workspace docs and stage contracts
52
+ - validate the result deterministically
250
53
 
251
- Each knowledge base or interface records a **workflow**:
54
+ For workflow authors, the important surface is:
252
55
 
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
56
+ - `workflow.json`
57
+ - `workflow/create/`
58
+ - `workflow/compile/stages/<stage>/`
59
+ - `workflow/use/query/`
60
+ - [`docs/workflow-spec.md`](./docs/workflow-spec.md)
261
61
 
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
62
+ ## What the agent sees
269
63
 
270
- In practice:
64
+ The compiled folder is the agent-facing product surface.
271
65
 
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
66
+ Important files in a KB or interface:
276
67
 
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
68
+ - `interf.json` = what this workspace is
69
+ - `AGENTS.md` = where to start and how to navigate
70
+ - `workflow/` = the editable local method package
71
+ - `home.md` = entry document
72
+ - `summaries/`, `knowledge/`, and `briefs/` = compiled outputs
281
73
 
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
74
+ Manual query/use works like this:
288
75
 
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
76
+ - open the KB or interface folder
77
+ - read `AGENTS.md`
78
+ - follow `workflow/use/query/SKILL.md`
79
+ - for interfaces, use local interface artifacts first, then the parent KB loop, then raw files if needed
294
80
 
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.
81
+ Interf does not require globally installed slash skills for workspace behavior. Local `workflow/.../SKILL.md` files are workspace instruction docs routed by `AGENTS.md` and stage contracts.
352
82
 
353
83
  ## Quick start
354
84
 
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:
85
+ Install the published package:
378
86
 
379
87
  ```bash
380
- cd ~/my-notes
381
- interf create interface
382
- interf compile
88
+ npm install -g @interf/compiler
383
89
  ```
384
90
 
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
91
+ Or install from source while contributing:
390
92
 
391
93
  ```bash
392
- interf init
94
+ npm install
95
+ npm run build
96
+ npm install -g .
393
97
  ```
394
98
 
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
99
+ Initialize Interf in any folder:
399
100
 
400
101
  ```bash
401
102
  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
103
+ interf init
429
104
  ```
430
105
 
431
- Knowledge-base compilation has two steps:
106
+ That flow can:
432
107
 
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`
108
+ - choose an executor like Claude Code or Codex
109
+ - optionally install global helper skills
110
+ - attach the current folder as a knowledge base
111
+ - compile the knowledge base immediately
435
112
 
436
- ### 4. Create interfaces when you need a focused workspace for a specific job
113
+ Then you can:
437
114
 
438
115
  ```bash
439
- cd ~/my-notes
440
116
  interf create interface
117
+ interf compile
118
+ interf benchmark
441
119
  ```
442
120
 
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
121
+ ## Example layout
466
122
 
467
123
  ```text
468
124
  source-folder/
469
- ...user files...
125
+ ...your files...
470
126
  interf/
471
127
  workflows/
472
128
  benchmarks/
@@ -475,534 +131,126 @@ source-folder/
475
131
  AGENTS.md
476
132
  CLAUDE.md
477
133
  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
134
  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
135
  summaries/
505
136
  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
137
  interfaces/
520
- {name}/
138
+ {interface-name}/
521
139
  interf.json
522
140
  compile-plan.md
523
141
  AGENTS.md
524
142
  CLAUDE.md
525
143
  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
144
  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
145
  knowledge/
551
- entities/
552
- claims/
553
146
  briefs/
554
147
  summaries/
555
148
  ```
556
149
 
557
- ## Config
150
+ ## Commands
558
151
 
559
- ### Knowledge-Base `interf.json`
152
+ - `interf init` = global setup first; if run inside a normal folder, it can also attach and compile a knowledge base there
153
+ - `interf create` = chooser when type is omitted
154
+ - `interf create knowledge-base` = attach current folder
155
+ - `interf create interface` = create an interface for the current folder's knowledge base
156
+ - `interf create workflow` = create a reusable workflow package
157
+ - `interf compile` = compile the current knowledge base or interface
158
+ - `interf benchmark` = compare compiled knowledge bases or interfaces with file-based evals
159
+ - `interf doctor` = preflight local executor setup before a real compile
160
+ - `interf status` = show deterministic health
161
+ - `interf verify <check>` = internal deterministic referee for major workflow steps
162
+ - `interf reset <scope>` = reset generated state while keeping source files
560
163
 
561
- Knowledge bases use the internal engine type `knowledge-base` in `interf.json` and runtime schemas.
164
+ ## Workflows
562
165
 
563
- ```json
564
- {
565
- "type": "knowledge-base",
566
- "name": "my-notes",
567
- "workflow": "interf",
568
- "source": {
569
- "path": "../.."
570
- }
571
- }
572
- ```
166
+ A workflow is a package, not just a prompt.
573
167
 
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
- ```
168
+ It has two layers:
586
169
 
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
170
+ - machine layer: `workflow.json`
171
+ - human/agent layer: `workflow/` docs
601
172
 
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:
173
+ Typical reusable workflow package:
640
174
 
641
175
  ```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
- }
176
+ interf/workflows/knowledge-base/<workflow-id>/
177
+ workflow.json
178
+ README.md
179
+ create/
180
+ SKILL.md
181
+ compile/
182
+ stages/
183
+ <stage-id>/
184
+ SKILL.md
185
+ use/
186
+ query/
187
+ SKILL.md
706
188
  ```
707
189
 
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
190
+ Interf keeps the public command surface stable while letting workflows vary the internal stage pipeline. The engine still owns contract kinds, required artifacts, and state flow.
719
191
 
720
- The benchmark wizard only offers targets whose current status is `compiled`, so stale or failed targets are visible but not benchmark-eligible.
192
+ ## Benchmarks and evals
721
193
 
722
- Why not prompt-plus-expected-answer first:
194
+ Interf is benchmark-first.
723
195
 
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
196
+ You can:
727
197
 
728
- Future versions can add query-based evals, but the default should stay file-first and understandable.
198
+ - build multiple knowledge bases over the same folder
199
+ - compare workflows on the same source set
200
+ - compare interfaces for the same business task
201
+ - inspect proofs, outputs, and costs locally
729
202
 
730
- Agent/test harness command:
203
+ Reusable benchmark specs and saved runs live under:
731
204
 
732
205
  ```text
733
- interf verify <check>
206
+ source-folder/
207
+ interf/
208
+ benchmarks/
209
+ knowledge-base/*.json
210
+ interface/*.json
211
+ runs/
734
212
  ```
735
213
 
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
214
+ This is the trust loop: don't trust a repo because it says its knowledge base is better. Run the benchmark on your folder.
762
215
 
763
- `interf compile` in an interface runs the selected workflow's stage graph.
216
+ ## Builder docs
764
217
 
765
- Built-in workflows currently use:
218
+ If you want to create your own workflows, start here:
766
219
 
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`
220
+ 1. [`docs/workflow-spec.md`](./docs/workflow-spec.md)
221
+ 2. [`docs/runtime-contract.md`](./docs/runtime-contract.md)
222
+ 3. [`docs/architecture.md`](./docs/architecture.md)
782
223
 
783
- Custom workflows can split or rename those stages, but they still have to satisfy the retrieval then analysis then output pipeline.
224
+ ## Maintainer test loop
784
225
 
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:
226
+ Full validation:
825
227
 
826
228
  ```bash
827
229
  npm test
828
- ```
829
-
830
- For a real local acceptance run against your configured coding agent:
831
-
832
- ```bash
833
230
  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
231
  npm run test:acceptance-compare
853
232
  ```
854
233
 
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:
234
+ Cached quick loop:
892
235
 
893
236
  ```bash
894
237
  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
238
  npm run test:acceptance-quick:create-interface
903
239
  npm run test:acceptance-quick:query-interface
904
240
  ```
905
241
 
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.
242
+ The cached quick fixture lives under `.interf-test-cache/latest-quick/`.
916
243
 
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.
244
+ ## Design choices
993
245
 
994
- ## Principles
246
+ - filesystem-first, not service-first
247
+ - workflow packages over hidden orchestration
248
+ - contract-checked stages instead of prompt-only trust
249
+ - benchmarkability as a core product feature
250
+ - local control: your files stay on disk and run in your environment
995
251
 
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
252
+ Interf is not trying to win by hiding complexity. It is trying to make the method visible, enforceable, and comparable.
1003
253
 
1004
254
  ## License
1005
255
 
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).
256
+ Code is licensed under Apache 2.0. The `Interf` name and branding are reserved; see [`TRADEMARKS.md`](./TRADEMARKS.md).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@interf/compiler",
3
- "version": "0.1.8",
4
- "description": "Compile any folder into an LLM knowledge base.",
3
+ "version": "0.1.10",
4
+ "description": "Filesystem-first knowledge compiler for agent-ready knowledge bases and interfaces.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "interf": "dist/bin.js"