codeassembly-agent-logic 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,37 @@
1
1
  [
2
+ {
3
+ "version": "0.2.1",
4
+ "date": "2026-11-12",
5
+ "sections": [{ "title": "Notes", "audience": "dev", "items": [{ "description": "Forced version bump." }] }]
6
+ },
7
+ {
8
+ "version": "0.2.0",
9
+ "date": "2026-11-09",
10
+ "sections": [
11
+ {
12
+ "title": "🎉 Features",
13
+ "audience": "all",
14
+ "items": [
15
+ {
16
+ "description": "Exports `buildElkGraph` and its `ElkGraphOptions` type from the root entry of `codeassembly-agent-logic`, so that a consumer can build the unpositioned graph that `toFlowElements` reads without running the ELK layout engine. (#2265)",
17
+ "hash": "7496ad815a8c3548be94cecb66e6c0d1875fa403",
18
+ "entry": 1
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ "title": "⚙️ Tooling",
24
+ "audience": "dev",
25
+ "items": [
26
+ {
27
+ "description": "Adds the agent-logic corpus under `packages/agent-logic/corpus/` and the `refresh-corpus` and `score-corpus` scripts, which copy each prompt from the file that Claude Code loads and regenerate `corpus/scorecard.md`, with a test that fails when the committed scorecard differs. (#2264)",
28
+ "hash": "a44d71443b85af4c25b2ac593c8bcab87c1e2b2c",
29
+ "entry": 1
30
+ }
31
+ ]
32
+ }
33
+ ]
34
+ },
2
35
  {
3
36
  "version": "0.1.0",
4
37
  "date": "2026-11-09",
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.2.1 — 2026-11-12
6
+
7
+ ### Notes
8
+
9
+ - Forced version bump.
10
+
11
+ ## 0.2.0 — 2026-11-09
12
+
13
+ ### 🎉 Features
14
+
15
+ - Exports `buildElkGraph` and its `ElkGraphOptions` type from the root entry of `codeassembly-agent-logic`, so that a consumer can build the unpositioned graph that `toFlowElements` reads without running the ELK layout engine. (#2265)
16
+
17
+ ### ⚙️ Tooling
18
+
19
+ - Adds the agent-logic corpus under `packages/agent-logic/corpus/` and the `refresh-corpus` and `score-corpus` scripts, which copy each prompt from the file that Claude Code loads and regenerate `corpus/scorecard.md`, with a test that fails when the committed scorecard differs. (#2264)
20
+
5
21
  ## 0.1.0 — 2026-11-09
6
22
 
7
23
  ### 🎉 Features
package/README.md CHANGED
@@ -1,20 +1,3 @@
1
- <!-- section:release-notes -->
2
- ## Release notes — v0.1.0 (2026-11-09)
3
-
4
- ### 🎉 Features
5
-
6
- - Adds the initial `codeassembly-agent-logic` package, whose `contract`, `react`, and `server` subpath entries are placeholders and whose `agent-logic` command prints a usage message that doesn't list any commands yet. (#2257)
7
- - Adds the agent-logic config schema, its validation, the converter, the coverage check, the chart layout, source marking, and the bundled examples to the root entry of `codeassembly-agent-logic`, and exports the config's JSON Schema as `codeassembly-agent-logic/agent-logic.schema.json`. (#2260)
8
- - Adds `StatechartCanvas` and the hooks of a page that presents a chart to `codeassembly-agent-logic/react`, with a `renderKey` slot through which each app draws the canvas's key, and a `react/styles.css` stylesheet that an app themes through `--agent-logic-*` custom properties. (#2260)
9
- - Adds `createViewerServerPlugins` to `codeassembly-agent-logic/server`, which returns the Vite plugins that serve a prompts directory and run conversions through a harness hosted by telefactor, and adds the viewer contract, the conversion job contract, and the built-in harnesses to `codeassembly-agent-logic/contract`. (#2260)
10
- - Adds the `convert`, `check-coverage`, and `rules` commands to the `agent-logic` bin, which turn a model's draft of a prompt's logic into a config, check a coverage map against the prompt, and print the extraction rules that the package ships, so that a skill can run them through `pnpm dlx` without an installed copy. (#2260)
11
-
12
- ### 🐛 Bug fixes
13
-
14
- - Fixes the issue that `agent-logic check-coverage` did not recognize a fenced code block indented under a list item, so that it reported the block's lines as unmapped and ran the block to the end of the prompt. (#2261)
15
- - Fixes the issue that `agent-logic` read an HTML comment as prompt text when the comment followed a lone backtick or a line that opens with an inline triple-backtick span. (#2261)
16
- <!-- /section:release-notes -->
17
-
18
1
  <!-- readme-type: library -->
19
2
 
20
3
  # codeassembly-agent-logic
@@ -39,14 +22,14 @@ if (result.ok) {
39
22
 
40
23
  ## Entries
41
24
 
42
- | Entry | Exports |
43
- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
44
- | `codeassembly-agent-logic` | The config schema and its validation, the converter and coverage check, the chart description and layout, source marking, and the bundled examples. |
45
- | `codeassembly-agent-logic/react` | `StatechartCanvas`, the key's entries as data (`CANVAS_KEY_ENTRIES` and the mark glyphs), and the hooks of a page that presents a chart. |
46
- | `codeassembly-agent-logic/react/styles.css` | The canvas stylesheet. |
47
- | `codeassembly-agent-logic/server` | `createViewerServerPlugins`, the Vite plugins that serve the prompts directory and run conversions through a harness that telefactor hosts. |
48
- | `codeassembly-agent-logic/contract` | The contracts between a page and its server: the viewer contract, the conversion job, and the built-in harnesses. |
49
- | `codeassembly-agent-logic/agent-logic.schema.json` | The config's JSON Schema. |
25
+ | Entry | Exports |
26
+ | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27
+ | `codeassembly-agent-logic` | The config schema and its validation, the converter and coverage check, the chart description, its ELK graph (`buildElkGraph`), its layout, source marking, and the bundled examples. |
28
+ | `codeassembly-agent-logic/react` | `StatechartCanvas`, the key's entries as data (`CANVAS_KEY_ENTRIES` and the mark glyphs), and the hooks of a page that presents a chart. |
29
+ | `codeassembly-agent-logic/react/styles.css` | The canvas stylesheet. |
30
+ | `codeassembly-agent-logic/server` | `createViewerServerPlugins`, the Vite plugins that serve the prompts directory and run conversions through a harness that telefactor hosts. |
31
+ | `codeassembly-agent-logic/contract` | The contracts between a page and its server: the viewer contract, the conversion job, and the built-in harnesses. |
32
+ | `codeassembly-agent-logic/agent-logic.schema.json` | The config's JSON Schema. |
50
33
 
51
34
  React 19 is a peer of `./react`, and `@williamthorsen/telefactor` a peer of `./server` and `./contract`.
52
35
 
@@ -83,4 +66,4 @@ pnpm dlx codeassembly-agent-logic convert prompt.md draft.json prompt.agent-logi
83
66
  pnpm dlx codeassembly-agent-logic check-coverage prompt.md coverage-map.json
84
67
  ```
85
68
 
86
- `rules` prints the [extraction rules](docs/extraction-rules.md) by which a model drafts a prompt's logic; `convert` turns the draft into a config; `check-coverage` checks a map of the prompt's instructions against the prompt. `agent-logic <command> --help` describes each command's arguments. [Conversion agreement](docs/conversion-agreement.md) records how consistently a model converts the same prompt.
69
+ `rules` prints the [extraction rules](docs/extraction-rules.md) by which a model drafts a prompt's logic; `convert` turns the draft into a config; `check-coverage` checks a map of the prompt's instructions against the prompt. `agent-logic <command> --help` describes each command's arguments. [Conversion agreement](docs/conversion-agreement.md) records how consistently a model converts the same prompt, and the [corpus](docs/corpus.md) measures conversions of real prompts.
@@ -4,6 +4,7 @@ export * from './convert/draft-schema.js';
4
4
  export * from './coverage-map/check-coverage.js';
5
5
  export * from './coverage-map/coverage-map-schema.js';
6
6
  export * from './examples/examples.js';
7
+ export { buildElkGraph, type ElkGraphOptions } from './layout/build-elk-graph.js';
7
8
  export * from './layout/describe-config.js';
8
9
  export * from './layout/layout-config.js';
9
10
  export * from './layout/to-flow-elements.js';
package/dist/esm/index.js CHANGED
@@ -3,6 +3,7 @@ export * from "./convert/draft-schema.js";
3
3
  export * from "./coverage-map/check-coverage.js";
4
4
  export * from "./coverage-map/coverage-map-schema.js";
5
5
  export * from "./examples/examples.js";
6
+ export { buildElkGraph } from "./layout/build-elk-graph.js";
6
7
  export * from "./layout/describe-config.js";
7
8
  export * from "./layout/layout-config.js";
8
9
  export * from "./layout/to-flow-elements.js";
package/docs/corpus.md ADDED
@@ -0,0 +1,19 @@
1
+ # Corpus
2
+
3
+ The corpus measures the converter (the `convert-agent-prompt` skill, the [extraction rules](extraction-rules.md), and `agent-logic convert`) against real agent prompts. It is in the repository at [`packages/agent-logic/corpus/`](https://github.com/williamthorsen/codeassembly/tree/main/packages/agent-logic/corpus), and the published package does not contain it.
4
+
5
+ ## Contents
6
+
7
+ `corpus/` contains each prompt verbatim as `<name>.md` and its chart as `<name>.agent-logic.json`. Each prompt is the deployed skill that Claude Code loads, in which every partial and rulebook is expanded, not the skill's source. `corpus/records/` contains an out-of-scope prompt's `<name>.problems.json`, each reviewer's `<name>.review.json`, and `run.json`, which records where each prompt came from, the build or plugin version that produced it, and the run. [`src/corpus/corpus-schemas.ts`](https://github.com/williamthorsen/codeassembly/blob/main/packages/agent-logic/src/corpus/corpus-schemas.ts) defines the review file and `run.json`.
8
+
9
+ Each chart quotes its prompt by character offset, so the formatter does not touch `corpus/`.
10
+
11
+ ## Scoring
12
+
13
+ `pnpm run score-corpus`, run in `packages/agent-logic/`, regenerates `corpus/scorecard.md`, and a test fails when the committed scorecard differs. `--prompt <name>` prints one prompt's measures without its review, for the reviewer. `--skill <path>` compares the results against another copy of the skill.
14
+
15
+ A review records the blob ids of the skill's `SKILL.md` and of `extraction-rules.md` that its conversion followed. A result kept from an earlier round records a recheck against the current ones; the scorer refuses a result that has neither. The current skill is the copy in the `codeassembly-guidance` package that the repository root pins, so a guidance upgrade that changes the skill, or an edit to the extraction rules, fails the scorecard test until each result is rechecked or converted again.
16
+
17
+ ## Refreshing the prompts
18
+
19
+ `pnpm run refresh-corpus` copies each prompt that `run.json` lists from the file that Claude Code loads, and writes the provenance into `run.json`; [`src/corpus/refresh-corpus.ts`](https://github.com/williamthorsen/codeassembly/blob/main/packages/agent-logic/src/corpus/refresh-corpus.ts) names the files that it reads. It refuses when a declared source has uncommitted changes, when the source in the build's own repository is at another commit than the build, or when another source changed after the build. A refresh leaves the charts and reviews converted from the earlier prompts, so every prompt is converted and reviewed again after it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeassembly-agent-logic",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Model of an agent prompt's states and transitions, with React and server entries for the apps that present it",
5
5
  "keywords": [
6
6
  "agents",
@@ -57,7 +57,7 @@
57
57
  ],
58
58
  "dependencies": {
59
59
  "@hono/node-server": "2.1.6",
60
- "@williamthorsen/toolbelt.errors": "0.9.0",
60
+ "@williamthorsen/toolbelt.errors": "0.9.1",
61
61
  "@xyflow/react": "12.12.1",
62
62
  "elkjs": "0.12.1",
63
63
  "hono": "4.13.17",
@@ -67,12 +67,12 @@
67
67
  "@testing-library/dom": "10.4.2",
68
68
  "@testing-library/jest-dom": "7.0.1",
69
69
  "@testing-library/react": "16.3.3",
70
- "@testing-library/user-event": "14.6.8",
70
+ "@testing-library/user-event": "14.6.9",
71
71
  "@types/node": "24.19.2",
72
72
  "@types/react": "19.3.0",
73
73
  "@types/react-dom": "19.3.0",
74
- "@vitejs/plugin-react": "6.2.1",
75
- "@williamthorsen/nmr": "0.56.0",
74
+ "@vitejs/plugin-react": "6.3.0",
75
+ "@williamthorsen/nmr": "2.0.1",
76
76
  "@williamthorsen/telefactor": "0.4.1",
77
77
  "eslint": "10.14.0",
78
78
  "eslint-plugin-jest-dom": "5.10.1",
@@ -82,7 +82,7 @@
82
82
  "happy-dom": "21.0.4",
83
83
  "react": "19.3.1",
84
84
  "react-dom": "19.3.1",
85
- "vite": "8.3.6",
85
+ "vite": "8.3.8",
86
86
  "vitest": "5.1.0",
87
87
  "xstate": "5.33.4"
88
88
  },
@@ -103,6 +103,8 @@
103
103
  },
104
104
  "scripts": {
105
105
  "build:post": "cp src/react/styles.css dist/esm/react/styles.css",
106
- "generate:schema": "node src/schema/write-json-schema.ts"
106
+ "generate:schema": "node src/schema/write-json-schema.ts",
107
+ "refresh-corpus": "node src/corpus/refresh-corpus.ts",
108
+ "score-corpus": "node src/corpus/score-corpus-command.ts"
107
109
  }
108
110
  }