@interf/compiler 0.6.6 → 0.6.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/README.md CHANGED
@@ -1,32 +1,34 @@
1
1
  # Interf
2
2
 
3
- Interf prepares context for your agents.
4
- Use it to check whether your files are ready for the work you want your agents to do.
3
+ Interf prepares portable context for your agents.
4
+ Check the source files first. Build portable context when the agent misses evidence, loses links across files, or sounds confident without seeing the full picture.
5
5
 
6
- Tell Interf what you need from those files. It can compare how your local agents do on the source files. If the files alone are not enough, it builds portable context and keeps improving that context until more questions pass.
6
+ **The files can be right. The agent can still be wrong.**
7
7
 
8
- Interf Compiler builds that portable context as a local folder next to your files.
9
- Your source files stay the source of truth. Interf builds on them; it does not replace them.
8
+ Agents now run real work from folders of PDFs, exports, notes, and transcripts. The failure often shows up late: missed evidence, shallow analysis, bad comparisons, or answers that sound confident but are wrong.
10
9
 
11
- For the built-in `interf` workflow, portable context for your agents includes:
10
+ A chart inside one PDF can be obvious to a human analyst and easy for an agent to miss. Across the folder, the real problem is rarely one missing fact. The agent never assembles the full picture from the files on its own.
11
+
12
+ `Interf Compiler` is the local, open-source runtime that runs context-preparation workflows on your files. A workflow tells Interf how to process, organize, and structure those files for agent use. Your local agent runs each stage. Interf Compiler runs the pipeline and enforces the output shape. `interf test` scores the result on your own questions. The portable context is a proof, not a promise.
12
13
 
13
14
  ```text
14
- interf/market-report/
15
- AGENTS.md # how your agent should use this folder
16
- CLAUDE.md # same guidance for Claude Code
17
- home.md # top-level map for the work
18
- summaries/ # file-by-file summaries
19
- knowledge/ # linked notes built from those files
15
+ project-root/
16
+ bristol-office-analysis/
17
+ report.pdf
18
+ notes.md
19
+ exports/
20
+ interf.json # main config: works, source paths, questions, workflow choices, and defaults
21
+ interf/
22
+ bristol-office-analysis/ # portable context your agent starts from
23
+ tests/
24
+ bristol-office-analysis/ # saved source-files vs portable-context comparisons
20
25
  ```
21
26
 
22
- That is one example. Different workflows can build different folders. In every case, your agent starts from one local folder.
27
+ The project root is the control plane. Your agent starts from `interf/<work>/` when the source files are not enough.
23
28
 
24
- One public example from a PDF market report uses checks like:
29
+ ## What a Run Looks Like
25
30
 
26
- - `What were Bristol's annual take-up values in 2018 and 2016?`
27
- - `What were Bristol's availability values in 2018 and 2016?`
28
-
29
- On those same checks, one recent public comparison produced:
31
+ A recent public run one PDF market report, two questions, two agents on the same setup — produced:
30
32
 
31
33
  <!-- PUBLIC_BENCHMARK_TABLE:START -->
32
34
  | Agent | Source files | Portable context |
@@ -35,119 +37,164 @@ On those same checks, one recent public comparison produced:
35
37
  | Claude Code (Claude Opus 4.6, max) | `0/2` | `2/2` |
36
38
  <!-- PUBLIC_BENCHMARK_TABLE:END -->
37
39
 
38
- That means:
39
-
40
- - Codex already passed on the source files.
41
- - Claude Code needed the portable context to pass.
40
+ Codex passed on the raw files; Claude Code only passed after Interf prepared the portable context. Both numbers come from `interf test`, which scores the same questions against the source files and the portable context.
42
41
 
43
42
  That gives you a readiness signal for the work and a fair comparison on the same files.
44
43
 
45
- Same work. Same checks. Same local setup.
46
-
47
- ## How It Works
44
+ The table is a sample, not a leaderboard. Run it on your own files. If you run more than one local agent, the same pass gives you a fair comparison between them on the same files.
48
45
 
49
- 1. Pick the files for the work.
50
- 2. Tell Interf what you need from them.
51
- 3. Review or edit the questions.
52
- 4. Run a source-files baseline if you want to check readiness first.
53
- 5. Build the portable context for your agents.
54
- 6. Run `interf test` on the same questions.
46
+ ## Design Choices
55
47
 
56
- Check the source files first if you want the baseline. If the files already pass, keep them. If the portable context does better, use it.
48
+ - `Check before build`: source files are sometimes already enough. Interf will say so.
49
+ - `Prove the full picture`: every build is scored on your own questions. If the portable context does not help, `interf test` tells you.
50
+ - `File over app`: the portable context is a local folder next to the source files. Inspect it, diff it, version it.
51
+ - `Bring your own AI`: use Claude Code, Codex, or another local agent.
52
+ - `Explicit`: no hidden store, no hidden index. The portable context is plain files on disk.
57
53
 
58
- ## Why It Exists
54
+ ## Install
59
55
 
60
- Raw files are often not enough.
56
+ ```bash
57
+ npm install -g @interf/compiler
58
+ interf # opens the setup wizard in the current folder
59
+ ```
61
60
 
62
- Local agents can open reports, decks, transcripts, exports, PDFs, notes, and mixed folders. They can still miss the structure the work needs.
61
+ Requires Node.js 20+ and a local coding agent such as Claude Code or Codex. Run `interf doctor --live` if the executor is not detected.
63
62
 
64
- Interf checks the source files first. If they are already enough, keep them. If they are not, Interf builds a local context layer next to those files and checks whether it helped.
63
+ ## Quick Start
65
64
 
66
- Interf is built around a few simple rules:
65
+ 1. Run `interf` in the project root.
66
+ 2. Pick the source folder for one work.
67
+ 3. Describe what the agent should do with those files.
68
+ 4. Review the suggested questions.
69
+ 5. Run `interf test --target raw` to check the source files.
70
+ 6. Run `interf compile` to build portable context.
71
+ 7. Run `interf test` again to compare source files and portable context on the same questions.
72
+ 8. If the portable context does better, point your agent at `interf/<work>/`.
67
73
 
68
- - Explicit: the preparation stays on disk in a local folder you can inspect, diff, review, and version.
69
- - File over app: the result lives next to the source files.
70
- - Bring your own AI: use Claude Code, Codex, or another local agent. Automated Interf runs currently support Claude Code and Codex.
71
- - Proof over vibes: check source files and portable context on the same work.
72
- - Source files stay the source of truth.
74
+ If the source files already pass, stop there. Interf is allowed to tell you that you do not need portable context for that work.
73
75
 
74
- ## Folder Layout
76
+ ## Portable Context
75
77
 
76
- If your folder already contains the files for the work, Interf adds a small local structure around them:
78
+ `interf/<work>/` is the local folder your agent starts from when the source files are not enough. For the built-in `interf` workflow, it includes:
77
79
 
78
80
  ```text
79
- your-folder/
80
- market-report/
81
- report.pdf
82
- notes.md
83
- exports/
84
- interf.json
85
- interf/
86
- market-report/
87
- tests/
88
- market-report/
81
+ interf/bristol-office-analysis/
82
+ AGENTS.md # how to use this folder
83
+ CLAUDE.md # same guidance for Claude Code
84
+ raw/ # snapshot of the source files for this work
85
+ home.md # top-level map for the work
86
+ summaries/ # per-file summaries
87
+ knowledge/ # linked notes built from the files
89
88
  ```
90
89
 
91
- `market-report` is just the work name. Interf reuses it under `interf/` and `interf/tests/`.
90
+ The source files stay the source of truth. Interf builds next to them; it does not replace them.
92
91
 
93
- When Interf finishes, point your agents at `interf/market-report/` first. Go back to the source files whenever you need to verify something.
92
+ The portable context is a sibling folder you can inspect, diff, version, or hand to a different agent. The portable context carries its own `raw/` snapshot, so the evidence the agent works from stays attached to the result.
94
93
 
95
- ## Quick Start
94
+ ## Workflow Packages
96
95
 
97
- Requirements:
96
+ A workflow is Interf's preparation method for a kind of work. It tells the compiler how to process the source files and what folder shape to build for the agent. The workflow declares the compilation stages. Your local agent runs each one. The compiler writes the result as one folder on disk.
98
97
 
99
- - Node.js 20+
100
- - a local coding agent such as Claude Code or Codex
98
+ A **context interface** is the shape of that output — the folder tree, the named files, and the rule that every one of them must exist on disk before the build is called done. The workflow defines the interface. The compiler enforces it.
101
99
 
102
- Install:
100
+ The built-in `interf` workflow is the default. Run `interf create workflow` to draft a reusable workflow package for a different kind of work — a different method, a different output shape, or both.
103
101
 
104
- ```bash
105
- npm install -g @interf/compiler
102
+ ```text
103
+ interf/workflows/office-analysis/
104
+ workflow.json # method: how to process and organize the files
105
+ workflow.schema.json # output contract: what folder shape the compiler must build
106
+ README.md # what this workflow is for, for humans and agents
107
+ compile/
108
+ stages/
109
+ summarize/ # define your own stages here
110
+ structure/
111
+ shape/
112
+ use/
113
+ query/ # how your agent reads the portable context
114
+ improve/ # how Interf revises this workflow if questions still fail
106
115
  ```
107
116
 
108
- Then run Interf in a project folder that already contains the files for the work:
117
+ Think of it as method -> output shape.
109
118
 
110
- ```bash
111
- interf
112
- ```
119
+ - `workflow.json` describes the method: expected inputs, stages, and how the files should be processed.
120
+ - `workflow.schema.json` describes the output contract: the folder shape and outputs the compiler must build.
121
+ - `compile/stages/<stage>/` is where you author one folder per stage — a small, specific job like `summarize` or `structure`. You write the instructions; the compiler runs them with your local agent.
122
+ - `use/query/` holds the instructions your agent follows when it reads the portable context for live work.
123
+ - `improve/` holds the instructions Interf follows when the first build does not pass and the workflow itself needs editing.
113
124
 
114
- The first run opens the setup wizard for that folder. It can:
125
+ A workflow package is the reusable preparation method. Interf Compiler runs it on your files. Your local agent runs each stage. The result is a local folder your agents can read.
115
126
 
116
- - draft `interf.json`
117
- - let you choose the source folder for the work
118
- - ask what work you need help with
119
- - recommend questions you can verify from the files, or let you add them manually
120
- - run a source-files baseline so you can see whether the files are already enough
121
- - build the portable context your agents will use for that work
122
- - check that portable context on the same questions
127
+ ## Compiler Primitives
123
128
 
124
- If Interf cannot find your local executor setup, run:
129
+ Every workflow runs on the same three primitives. Interf Compiler enforces the contract. The workflow chooses the method.
125
130
 
126
- ```bash
127
- interf doctor --live
131
+ ### Input snapshot
132
+
133
+ The workflow declares what source files it expects — one PDF, a folder of mixed exports, a tree of notes. Interf Compiler copies those inputs into `raw/` before any stage runs. The evidence stays attached to the result.
134
+
135
+ ### Context interface
136
+
137
+ The workflow declares the folder shape the agent must read. Interf Compiler checks on disk that the shape holds before the build is called done. If a stage writes nothing, the build fails loudly.
138
+
139
+ ### Stage execution
140
+
141
+ The workflow declares ordered compilation stages — small, specific jobs like `summarize`, `structure`, `shape`. You write the instructions per stage. Interf Compiler runs each one through your local agent and checks the output before moving to the next.
142
+
143
+ The context interface is the key guarantee. The shape holds on disk, or `interf test` reports the gap on your own questions.
144
+
145
+ ## Self-Improving Workflows
146
+
147
+ When the first build still misses questions, Interf edits the workflow package itself and compiles again. Same files, same questions, different preparation. The workflow is the unit of improvement — not just the output folder.
148
+
149
+ Interf saves every scored run under `interf/tests/<work>/`. You can inspect what changed and why a later build did better.
150
+
151
+ ## How the Pieces Fit
152
+
153
+ - `interf.json` is the project control file. It names the work, points at the source files, saves the questions, and selects the workflow.
154
+ - A workflow package is the reusable preparation method.
155
+ - `workflow.json` defines that method.
156
+ - `workflow.schema.json` defines the output contract, or context interface, the compiler must build.
157
+ - `Interf Compiler` is the local runtime. It runs the workflow, your agent runs each stage, and the portable context lands next to the source files.
158
+ - The portable context is the local folder built for your agents. Technically, that folder is the compiled context.
159
+
160
+ ## interf.json
161
+
162
+ `interf.json` is the main config file in the project root. Each entry describes one work: the source path, the saved questions, the workflow that prepares the context, and optional defaults.
163
+
164
+ ```text
165
+ {
166
+ "datasets": [
167
+ {
168
+ "name": "bristol-office-analysis",
169
+ "path": "./bristol-office-analysis",
170
+ "about": "Read the report and answer the saved questions.",
171
+ "workflow": "interf",
172
+ "checks": [
173
+ { "question": "...", "answer": "..." }
174
+ ]
175
+ }
176
+ ]
177
+ }
128
178
  ```
129
179
 
130
- ## Checks
180
+ The `workflow` field is the key choice per work. Set it to `interf` for the built-in workflow, or to a workflow you have authored. A different workflow is a different method and a different output shape. Same files, different portable context.
131
181
 
132
- Interf uses question-and-answer checks.
133
- They are small questions that tell you whether the work is actually covered.
182
+ ## Questions
134
183
 
135
- Interf runs the same checks on the source files and on the portable context. That gives you a source-files baseline and a portable-context comparison on the same task.
184
+ In the flow, they look like plain questions. In `interf.json`, they live under `checks[]`.
136
185
 
137
- Good first checks are small and easy to verify from the files:
186
+ They should be small, verifiable facts you already know from the files:
138
187
 
139
188
  - one exact number from a chart, table, or filing
140
189
  - one short statement that should be true or false
141
- - one simple comparison across years, files, or sections
142
-
143
- Interf can recommend a starting set from the files and the work description. You can confirm, edit, or replace them.
190
+ - one comparison across years, files, or sections
144
191
 
145
- In the CLI, you mostly see them as questions. In `interf.json`, they live under the technical field `checks[]`.
192
+ Interf proposes an initial set from the files and the work description. You confirm, edit, or replace them.
146
193
 
147
194
  A maintained public test example in this repo stores them like this:
148
195
 
149
196
  <!-- PUBLIC_TEST_CHECKS:START -->
150
- ```jsonc
197
+ ```text
151
198
  {
152
199
  "datasets": [
153
200
  {
@@ -170,106 +217,29 @@ A maintained public test example in this repo stores them like this:
170
217
  ```
171
218
  <!-- PUBLIC_TEST_CHECKS:END -->
172
219
 
173
- ## What `interf test` Measures
174
-
175
- `interf test` compares the source files and the portable context your agents would use on the same questions.
176
-
177
- That makes it a small benchmark for the work at hand:
178
-
179
- - same work
180
- - same checks
181
- - same local agent setup
182
- - source files on one side
183
- - portable context your agents use on the other
184
-
185
- If you run more than one local agent, it also gives you a fair comparison between them on the same files.
186
-
187
- If the portable context does not help, keep the source files.
188
-
189
- Use `interf test` on your own files instead of trusting a frozen benchmark snapshot in the docs.
190
-
191
- Interf saves the latest comparison plus the underlying source-files and portable-context runs under `interf/tests/` in the same project.
192
-
193
- ## The Compile And Check Loop
194
-
195
- 1. Save a few checks for the work in `interf.json`.
196
- 2. Run `interf test --target raw` if you want the source-files baseline.
197
- 3. Run `interf compile`.
198
- 4. Run `interf test`.
199
- 5. If self-improving loops are enabled, let Interf revise the workflow and try again on the same work and checks.
200
-
201
- `interf.json` stores the saved setup and checks. Technically, that portable context is the compiled context Interf reuses for repeat runs.
202
-
203
- ## Workflows
204
-
205
- A workflow is the preparation method Interf runs on your files.
206
-
207
- In plain language, it is the method that organizes and structures those files for agent use.
208
-
209
- It can summarize files, extract structure, and build the local context layer your agent starts from.
210
-
211
- Interf runs that method with your local coding agent and builds the result on disk as portable context.
212
-
213
- The folder shape it produces for the agent is the context interface. The reusable method itself is the workflow package.
220
+ ## What Interf Is Not
214
221
 
215
- Publicly, you mostly care about the portable context it produces. Technically, that portable context is the compiled context.
222
+ - Not a second brain or memory product. One local folder per work; nothing global.
223
+ - Not a vector store or RAG server. The portable context is plain files.
224
+ - Not a hosted context layer. Interf runs locally and `interf/` is yours.
225
+ - Not an agent harness. Interf prepares the folder; your existing agent reads it.
226
+ - Not a public leaderboard. Every score comes from your files, your questions, and your agent.
216
227
 
217
- Interf ships with a built-in `interf` workflow for the common case. If you need a different method, create one locally:
218
-
219
- ```bash
220
- interf create workflow
221
- ```
222
-
223
- Workflow creation supports two paths:
224
-
225
- - draft a workflow from the current project with a local agent
226
- - copy an existing workflow and edit stage guidance directly
227
-
228
- After assignment, build the portable context for your agents with `interf compile` and run `interf test` on the same questions.
229
-
230
- ## Self-Improving Loops
231
-
232
- Interf can do more than one compile pass.
233
-
234
- If the first portable context is still weak, Interf can revise the workflow and compile again.
235
-
236
- Each loop keeps the work and the checks fixed. The thing that changes is the preparation method.
237
-
238
- If self-improving loops are enabled, Interf can:
239
-
240
- - build the current portable context
241
- - run the same checks
242
- - inspect failures and traces
243
- - revise the workflow
244
- - build and test the next version
245
-
246
- Lower-level retry budgets live in `interf.json` and the technical package docs.
247
-
248
- ## Use It With Your Agent
249
-
250
- If you already work through a local coding agent, hand it the whole flow:
251
-
252
- Paste something like this into your agent:
253
-
254
- ```text
255
- Install `@interf/compiler`, run `interf` in this folder, and use the local agent executor.
256
-
257
- If `interf.json` is missing, draft one dataset entry for this work. Ask what I need from the selected files. Recommend a few questions I can verify from those files, and add the expected answers for me to confirm under `checks[]`.
258
-
259
- Run a source-files baseline if useful. Build the portable context for my agents for that work. Then run `interf test` on the same questions.
260
-
261
- Only recommend the portable context if it passes those questions. If you also ran the source-files baseline, tell me whether it did better than the source files.
262
- ```
228
+ ## Useful Commands
263
229
 
264
- ## More Docs
230
+ - `interf` or `interf init` — open the wizard and save the first setup
231
+ - `interf compile` — build portable context for your agents
232
+ - `interf test` — compare source files and portable context on the same questions
233
+ - `interf create workflow` — draft a reusable workflow package
234
+ - `interf doctor --live` — verify the local executor
265
235
 
266
- - [src/packages/README.md](./src/packages/README.md) for the short system map
267
- - [src/packages/compiler/PACKAGE.md](./src/packages/compiler/PACKAGE.md) for compiler primitives and the runtime contract
268
- - [src/packages/workflow-package/PACKAGE.md](./src/packages/workflow-package/PACKAGE.md) for the workflow package model
269
- - [src/packages/workflow-authoring/PACKAGE.md](./src/packages/workflow-authoring/PACKAGE.md) for workflow authoring and self-improving loops
236
+ ## Docs
270
237
 
271
- Maintainers should use [CONTRIBUTING.md](./CONTRIBUTING.md) for test and release gates.
238
+ - [src/packages/README.md](./src/packages/README.md) system map
239
+ - [src/packages/compiler/PACKAGE.md](./src/packages/compiler/PACKAGE.md) — compiler primitives and runtime contract
240
+ - [src/packages/workflow-package/PACKAGE.md](./src/packages/workflow-package/PACKAGE.md) — workflow package model
241
+ - [src/packages/workflow-authoring/PACKAGE.md](./src/packages/workflow-authoring/PACKAGE.md) — workflow authoring and workflow improvement
272
242
 
273
- ## License
243
+ Contributors: see [CONTRIBUTING.md](./CONTRIBUTING.md).
274
244
 
275
- Code is licensed under Apache 2.0. The `Interf` name and branding are reserved; see [TRADEMARKS.md](./TRADEMARKS.md).
245
+ Code: Apache 2.0. Name and branding: see [TRADEMARKS.md](./TRADEMARKS.md).
@@ -456,7 +456,7 @@ export const initCommand = {
456
456
  };
457
457
  export async function runInitCommand() {
458
458
  p.intro(chalk.bold("Interf"));
459
- p.log.info("Interf prepares context for your agents from the source folder you choose. Start with the work, review the suggested questions, check the source files first, and build a local folder when the files need more structure.");
459
+ p.log.info("Interf prepares portable context for your agents from the source folder you choose. Start with the work, review the suggested questions, check the source files first, and build a local folder when the files need more structure.");
460
460
  const cwd = process.cwd();
461
461
  const detected = detectInterf(cwd);
462
462
  const sourcePath = detected ? resolveSourceControlPath(detected.path) : cwd;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@interf/compiler",
3
- "version": "0.6.6",
4
- "description": "Interf prepares context for your agents by checking your files first, building a local folder when needed, and using self-improving loops until more questions pass.",
3
+ "version": "0.6.8",
4
+ "description": "Interf prepares portable context for your agents by checking your files first, building a local folder when needed, and using self-improving loops until more questions pass.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "interf": "dist/bin.js"