knodin 0.8.7 → 0.9.0

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 (44) hide show
  1. package/dist/bin/cli.js +307 -85
  2. package/dist/fixtures/update-verification/config/application.xml +4 -0
  3. package/dist/fixtures/update-verification/dbt/manifest.json +17 -0
  4. package/dist/fixtures/update-verification/dbt/models/accounts.sql +1 -0
  5. package/dist/fixtures/update-verification/dbt/models/contacts.sql +1 -0
  6. package/dist/fixtures/update-verification/fixture.json +147 -0
  7. package/dist/fixtures/update-verification/force-app/main/default/classes/UpdateFixture.cls +14 -0
  8. package/dist/fixtures/update-verification/force-app/main/default/flows/Update_Verification.flow-meta.xml +9 -0
  9. package/dist/fixtures/update-verification/package.json +5 -0
  10. package/dist/fixtures/update-verification/prisma/schema.prisma +10 -0
  11. package/dist/fixtures/update-verification/sql/functions.sql +16 -0
  12. package/dist/fixtures/update-verification/src/CsharpFixture.cs +6 -0
  13. package/dist/fixtures/update-verification/src/JavaFixture.java +9 -0
  14. package/dist/fixtures/update-verification/src/javascript.js +7 -0
  15. package/dist/fixtures/update-verification/src/python_fixture.py +6 -0
  16. package/dist/fixtures/update-verification/src/typescript.ts +7 -0
  17. package/dist/fixtures/update-verification/terraform/main.tf +7 -0
  18. package/dist/fixtures/update-verification/terraform/modules/verified-child/main.tf +3 -0
  19. package/dist/src/agent-integration.js +26 -3
  20. package/dist/src/backup-retention.js +811 -0
  21. package/dist/src/cli-model.js +35 -8
  22. package/dist/src/docs-sections.js +1 -0
  23. package/dist/src/doctor.js +142 -12
  24. package/dist/src/engine/embeddings.js +8 -1
  25. package/dist/src/engine/index.js +355 -292
  26. package/dist/src/init.js +222 -179
  27. package/dist/src/manager-update.js +455 -0
  28. package/dist/src/release-preflight.js +106 -95
  29. package/dist/src/repair-lease.js +77 -8
  30. package/dist/src/response-budget.js +5 -1
  31. package/dist/src/server.js +18 -5
  32. package/dist/src/shared-index/compatibility.js +4 -2
  33. package/dist/src/tools/knodin-tools.js +69 -10
  34. package/dist/src/update-ceremony.js +20 -24
  35. package/dist/src/update-coordination.js +158 -0
  36. package/dist/src/update-executor.js +336 -0
  37. package/dist/src/update-verifier.js +358 -0
  38. package/docs/BACKUP-RETENTION.md +54 -0
  39. package/docs/CLI.md +6 -0
  40. package/docs/DOCTOR-AND-UPDATES.md +44 -12
  41. package/docs/SIGNED-UPDATES.md +29 -22
  42. package/docs/releases/0.9.0.md +43 -0
  43. package/package.json +7 -1
  44. package/roadmap/competitive-roadmap.md +8 -0
@@ -0,0 +1,54 @@
1
+ # Backup discovery and retention
2
+
3
+ Knodin graph promotions leave completed snapshots named
4
+ `db.sqlite.backup.<13-digit epoch-ms>.<8-hex-id>` beside the live database.
5
+ They are promotion snapshots, not a supported restore interface. Malformed and
6
+ legacy names are inventory-only and are never pruning candidates.
7
+
8
+ Nothing is deleted by default. Inspect one checkout or bounded portfolio roots:
9
+
10
+ ```bash
11
+ knodin backups list
12
+ knodin backups list ~/code --depth 5 --json
13
+ knodin backups prune # preview only
14
+ knodin backups prune ~/code --apply # explicit one-shot deletion
15
+ ```
16
+
17
+ The default plan retains every snapshot younger than three days and at least
18
+ the newest completed snapshot per repository. Apply revalidates every candidate
19
+ under Knodin's repository lifecycle lease. A promotion marker, unsafe or absent
20
+ live `db.sqlite`, symlink, changed candidate, lease contention, containment
21
+ ambiguity, or permission failure is reported as a skip instead of being deleted.
22
+ Discovery never follows directory symlinks and prunes common dependency/build
23
+ trees. It unions explicit roots with valid absolute checkout paths in
24
+ `$XDG_CONFIG_HOME/knodin/repositories.yaml`.
25
+
26
+ ## Opt-in ongoing retention
27
+
28
+ Installation is the consent boundary:
29
+
30
+ ```bash
31
+ knodin backups retention install ~/code
32
+ knodin backups retention status
33
+ knodin backups retention doctor
34
+ knodin backups retention remove
35
+ ```
36
+
37
+ Options are `--retention-days` (3), `--keep-newest` (1), `--depth` (5),
38
+ `--schedule` (`04:17` local), and `--dry-run`. Installation writes a versioned
39
+ policy to `$XDG_CONFIG_HOME/knodin/backup-retention.json` and owned receipt/run
40
+ state beneath `$XDG_STATE_HOME/knodin/backup-retention/`. Ordinary Knodin use
41
+ may then clean only its current repository, at most once daily. Removal disables
42
+ this behavior and deletes only scheduler files whose content still matches the
43
+ recorded receipt.
44
+
45
+ macOS uses a copied LaunchAgent with a daily trigger and `RunAtLoad`. Linux uses
46
+ a persistent user systemd timer. Windows uses one Scheduled Task with daily and
47
+ logon triggers. Unsupported scheduler environments do not weaken one-shot
48
+ preview/apply pruning. Structured run logs are retained for at most 30 days and
49
+ each daily log is bounded to 5 MiB.
50
+
51
+ If a personal `mem-watchdog` currently handles these files, leave it running
52
+ until `knodin backups retention doctor` reports healthy and a native run has
53
+ been verified. Then disable the watchdog through its own configuration. Knodin
54
+ does not modify or remove it.
package/docs/CLI.md CHANGED
@@ -35,6 +35,12 @@ knodin repos search --help
35
35
  knodin update --help
36
36
  ```
37
37
 
38
+ Backup discovery and pruning are native and cross-platform. `knodin backups
39
+ list` and the default `knodin backups prune` are read-only; deletion requires
40
+ `--apply`, while recurring cleanup requires the separate `knodin backups
41
+ retention install` consent step. See `docs/BACKUP-RETENTION.md` for safety,
42
+ scheduler, logging, and removal details.
43
+
38
44
  `repos search` resolves configured system memberships independently for every
39
45
  discovered checkout. Symbol search remains primary. When it returns no matches,
40
46
  or a multi-term query has only weak single-term symbol coverage, Knodin performs
@@ -12,14 +12,17 @@
12
12
  - graph health;
13
13
  - configured registry/channel;
14
14
  - cached latest **trusted** release state; and
15
+ - read-only backup inventory, reclaimable bytes, installed-retention health,
16
+ last run, skips, and remediation; and
15
17
  - the manager-safe action boundary when a signed update is known.
16
18
 
17
19
  A manager is reported as known only from manager-owned environment evidence or
18
20
  an identified shim. A path substring is labeled a medium-confidence heuristic,
19
21
  not proof.
20
22
 
21
- The former npm `latest` lookup has been removed from production paths. Doctor,
22
- CLI status, and MCP status now consume the same signed-only state as:
23
+ Signed authorization remains separate from package-manager availability.
24
+ Doctor, CLI status, and MCP status expose both states without treating registry
25
+ metadata as signing authority. The existing signed commands remain:
23
26
 
24
27
  ```bash
25
28
  knodin update status
@@ -29,10 +32,37 @@ knodin update apply
29
32
  knodin update rollback
30
33
  ```
31
34
 
32
- Until the production root ceremony embeds an independently reviewed root and
33
- pin, these commands report `trust-unconfigured` and make no request. A user
34
- configuration file containing both a root path and its digest is deliberately
35
- inert: accepting both from one mutable file would not be independent pinning.
35
+ Manager-aware commands bind availability and execution to the active executable
36
+ chain, package root, manager receipts, and PATH evidence:
37
+
38
+ ```bash
39
+ knodin update available
40
+ knodin update upgrade [version] [--apply]
41
+ knodin update pin <version> [--apply]
42
+ knodin update unpin
43
+ knodin update acknowledge
44
+ knodin update auto status|enable|disable|run
45
+ ```
46
+
47
+ Homebrew ownership queries only bounded `knodin/homebrew-tap` version metadata;
48
+ npm, mise, Volta, nvm, fnm, and asdf ownership queries only bounded npm registry
49
+ metadata. Duplicate installations, stale links, PATH shadowing, missing safety
50
+ metadata, and ambiguous ownership are approval-required states. Doctor prints
51
+ exact ownership evidence and manual cleanup guidance; Knodin never removes a
52
+ competing installation.
53
+
54
+ `upgrade` and `pin` are plans unless `--apply` is explicit. Apply writes and
55
+ fsyncs a durable journal around every manager and verification boundary, holds
56
+ the user-level exclusive update lease, and verifies an immutable multi-language
57
+ fixture. Exact rollback is verified by the same fixture and creates a distinct
58
+ automatic rollback pin. `npm install --global .` and other global source-tree
59
+ installations are not used by validation or activation.
60
+
61
+ Until the production root ceremony embeds a maintainer-attested root and
62
+ source-bound digest pin, these commands report `trust-unconfigured` and make no
63
+ request. A user configuration file containing both a root path and its digest
64
+ is deliberately inert: accepting both from one mutable file would let the same
65
+ mutable input replace the root and its pin.
36
66
 
37
67
  After activation, an interactive ordinary command may atomically claim a due
38
68
  background check. The foreground command does not wait for the network.
@@ -62,12 +92,14 @@ adapter; mise, Volta, nvm/fnm/asdf, Homebrew, and unknown ownership remain
62
92
  manager is ever asked to resolve a mutable version or tag, and a rollback is not
63
93
  reported successful until the restored installation passes its health check.
64
94
 
65
- Automatic activation also requires a certified sandbox smoke test. None is
66
- enabled in the production CLI yet, so `apply-patch`/`apply-minor` policies stop
67
- after verified quarantine instead of executing untrusted code. C64 supplies
68
- the provenance/SBOM and five-channel attestation machinery; the production
69
- release must populate it, and C65 must supply compromised-channel and recovery
70
- evidence before this gate can open.
95
+ Automatic manager activation is limited to releases explicitly marked
96
+ non-breaking patch updates after a 24-hour publication delay. It remains
97
+ disabled on a platform until the release timing matrix proves the complete
98
+ fixture at p95 ≤20 seconds and a hard limit of 60 seconds. Missing metadata,
99
+ minor/major changes, prereleases, ambiguity, and a failed or timed-out fixture
100
+ always require approval. The threshold-signed policy continues to
101
+ govern signed authorization and quarantine; manager availability never
102
+ substitutes for it.
71
103
 
72
104
  Run `knodin status --deep` for graph details and follow its typed repair steps:
73
105
  `knodin repair` repairs graph data, while `knodin init` restores lifecycle
@@ -17,12 +17,12 @@ must produce verified evidence before activation is enabled.
17
17
 
18
18
  The metadata model has four disjoint Ed25519 roles:
19
19
 
20
- | Role | Purpose | Maximum signed lifetime | Required threshold |
21
- | --- | --- | ---: | ---: |
22
- | `root` | Delegates keys and rotates trust | 366 days | At least 2 |
23
- | `targets` | Authorizes immutable release artifacts and channels | 93 days | At least 2 |
24
- | `snapshot` | Binds an exact targets version, length, and digest | 32 days | At least 1 |
25
- | `timestamp` | Publishes the current snapshot and bounds freezes | 8 days | At least 1 |
20
+ | Role | Purpose | Maximum signed lifetime | Required threshold |
21
+ | ----------- | --------------------------------------------------- | ----------------------: | -----------------: |
22
+ | `root` | Delegates keys and rotates trust | 366 days | At least 2 |
23
+ | `targets` | Authorizes immutable release artifacts and channels | 93 days | At least 2 |
24
+ | `snapshot` | Binds an exact targets version, length, and digest | 32 days | At least 1 |
25
+ | `timestamp` | Publishes the current snapshot and bounds freezes | 8 days | At least 1 |
26
26
 
27
27
  Root and targets thresholds prevent one stolen signing key from authorizing a
28
28
  release. All four roles must use separate, content-addressed keys. A root
@@ -84,8 +84,7 @@ old threshold. Recovery tests additionally cover missed sequential rotations,
84
84
  skipped roots, intermediate mirror disagreement, and malicious version jumps.
85
85
 
86
86
  An isolated 0.4.3 adversarial drill executed the trust, policy, CLI, and release-
87
- attestation suites together: 4 files and 52 scenarios passed on macOS with Node
88
- 26. Its machine-readable record is
87
+ attestation suites together: 4 files and 52 scenarios passed on macOS with Node 26. Its machine-readable record is
89
88
  `docs/evidence/0.4.3-update-defense-drill.json`. The record separately identifies
90
89
  the post-tag commit from which the drill executed and the immutable 0.4.3 source
91
90
  commit whose implementation it exercised, plus the environment, command,
@@ -95,10 +94,10 @@ they do not certify a real npm/Homebrew mutation path or replace the production
95
94
  ceremony and live drills.
96
95
 
97
96
  The verifier cannot make the first installation trustworthy by itself. A
98
- production release still requires an offline root-key ceremony, independent
99
- pin distribution, durable trusted-state storage, compromised-key rotation
100
- drills, and verified artifacts on every approved channel. Until that ceremony
101
- and C64–C65 are complete:
97
+ production release still requires a maintainer-attested root-key ceremony,
98
+ source-embedded digest pin, durable trusted-state storage, compromised-key
99
+ rotation drills, and verified artifacts on each enabled channel. Until that
100
+ ceremony is complete:
102
101
 
103
102
  - the former npm `latest` hint is not used by doctor, status, MCP, or update commands;
104
103
  - no release is authorized by `src/update-trust.ts` in production;
@@ -108,28 +107,36 @@ and C64–C65 are complete:
108
107
 
109
108
  ## Production key ceremony gate
110
109
 
111
- Private root keys must be created and retained offline under separate
112
- custodians. No production private key or recovery secret belongs in this
110
+ Private root keys must be created and retained offline by the maintainer. No
111
+ production private key or recovery secret belongs in this
113
112
  repository, CI variables, npm, Homebrew, GitHub, GHES, or Artifactory. Before
114
113
  activating signed checks, the release owners must record:
115
114
 
116
- - custodians and a two-person approval path;
117
- - public key IDs and the independently reviewed root-envelope digest;
115
+ - the accountable maintainer/custodian;
116
+ - public key IDs and the maintainer-attested root-envelope digest;
118
117
  - offline backup and recovery controls;
119
118
  - online targets/snapshot/timestamp key storage and rotation periods;
120
119
  - emergency revocation and root-rotation rehearsal evidence; and
121
120
  - the exact knodin source commit that first embeds the trusted root pin.
122
121
 
123
- This external ceremony is deliberately a release gate rather than generated
124
- test material masquerading as production trust.
125
-
126
- The fail-closed preparation contracts and multi-custodian rehearsal procedure
122
+ The fail-closed preparation contracts and solo-maintainer ceremony procedure
127
123
  are in [`ROOT-CEREMONY-RUNBOOK.md`](ROOT-CEREMONY-RUNBOOK.md). Their import seam
128
- accepts public material only and always returns `productionActivation: false`;
129
- it does not alter the production `trust-unconfigured` behavior.
124
+ accepts public material only and always returns `productionActivation: false`.
130
125
 
131
126
  ## Client policy and recovery
132
127
 
128
+ Package-manager availability is deliberately not a signature. The
129
+ manager-aware `available`, `upgrade`, `pin`, `unpin`, `acknowledge`, and `auto`
130
+ commands resolve the active owner and query only that owner's bounded channel.
131
+ The signed commands below retain their threshold authorization contract.
132
+
133
+ Executable replacement is serialized against repository lifecycle work with a
134
+ user-level lease. Every manager and verification boundary is fsynced in a
135
+ durable journal. An interrupted candidate or rollback remains unverified and
136
+ ordinary graph/MCP/lifecycle commands fail closed until recovery re-verifies it
137
+ or performs exact rollback. Candidate and rollback double failure persists
138
+ `terminal-unhealthy`; it is never reported as rollback success.
139
+
133
140
  The implemented policy modes are `notify-only`, `download-verify-only`,
134
141
  `apply-patch`, and `apply-minor`; major updates always require manual approval.
135
142
  Policies also bound release age, approved channels, enterprise mirror origins,
@@ -0,0 +1,43 @@
1
+ # knodin 0.9.0
2
+
3
+ This release prevents repository configuration from changing after the final
4
+ index and adds manager-aware, verified update workflows. It is marked breaking,
5
+ requires explicit approval to install, and does not enable automatic updates.
6
+
7
+ - Plain `knodin init` now owns only graph-local state and lifecycle hooks.
8
+ Agent instructions, MCP configuration, and repository skill directories are
9
+ changed only by explicit `knodin configure` or scoped initialization.
10
+ - `knodin repair` repairs graph state without configuration churn. Compatible
11
+ Knodin configuration entries are byte-identical no-ops, including existing
12
+ whitespace, foreign entries, and `type: stdio`.
13
+ - Configuration writes occur before the final index. Lifecycle leases, durable
14
+ event draining, bounded drift reconciliation, disk fingerprints, database
15
+ generations, and final deep health checks prevent a successful command from
16
+ reporting a graph that disagrees with disk.
17
+ - `knodin doctor` reports managed-file differences, ownership evidence, tracked
18
+ state, and exact manual restore, remove, or ignore instructions without
19
+ reverting, removing, reformatting, staging, or ignoring files itself.
20
+ - Update commands now detect Homebrew and npm-family ownership, fail closed for
21
+ ambiguous or shadowed installations, coordinate with repository lifecycle
22
+ work, and retain a durable verification and rollback journal.
23
+ - Candidate and rollback verification use an immutable multi-language fixture
24
+ and reject empty, partial, stale, ambiguous, truncated, unavailable, or
25
+ incorrect graph evidence. Exact rollback pins and human-readable attention
26
+ notices remain until explicitly acknowledged or unpinned.
27
+ - Update verification reuses the machine-scoped local model cache while keeping
28
+ repository and configuration fixtures isolated, avoiding redundant model
29
+ downloads without weakening semantic-readiness checks.
30
+ - Opt-in backup retention adds bounded inventory, preview/apply pruning,
31
+ scheduler installation, status, doctor, and removal across supported
32
+ platforms. Destructive runs fail closed on invalid policy or ownership
33
+ receipts, active lifecycle work, unsafe live databases, promotion markers,
34
+ changed candidates, and scheduler artifacts outside Knodin-owned paths.
35
+ - Failed retention reinstallation restores the prior policy and scheduler bytes,
36
+ and generated lifecycle hooks keep structured JSONL records separate from
37
+ process diagnostics.
38
+
39
+ Automatic update eligibility remains disabled by default. Linux fixture runs
40
+ met the recorded performance threshold; macOS did not meet the p95 threshold in
41
+ the recorded local run, and Windows has not been certified. The 24-hour
42
+ publication window is only a delay and is not evidence that a release is
43
+ healthy.
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "knodin",
3
- "version": "0.8.7",
3
+ "version": "0.9.0",
4
+ "knodin": {
5
+ "compatibility": "breaking"
6
+ },
4
7
  "description": "knodin — source-evidenced local code intelligence with known bounds. Stable identity, fresh evidence, truthful budgets, and recoverable bounded views.",
5
8
  "license": "MIT",
6
9
  "repository": {
@@ -25,6 +28,7 @@
25
28
  "docs/prompts/declare-multi-repository-system.md",
26
29
  "docs/DEAD-CODE-AND-IMPACT.md",
27
30
  "docs/DOCTOR-AND-UPDATES.md",
31
+ "docs/BACKUP-RETENTION.md",
28
32
  "docs/DIAGNOSTICS.md",
29
33
  "docs/BEHAVIORAL-CONTRACT.md",
30
34
  "docs/DEMO.md",
@@ -66,6 +70,7 @@
66
70
  "docs/releases/0.8.5.md",
67
71
  "docs/releases/0.8.6.md",
68
72
  "docs/releases/0.8.7.md",
73
+ "docs/releases/0.9.0.md",
69
74
  "docs/assets/knodin-favicon.svg",
70
75
  "docs/SYSTEMS-AND-RELATIONSHIPS.md",
71
76
  "docs/TELEMETRY.md",
@@ -100,6 +105,7 @@
100
105
  "mirror:sync": "sh tools/hooks/sync-ghes-mirror.sh",
101
106
  "test:pack-install": "tsx scripts/pack-install-smoke.ts",
102
107
  "test:package-managers": "tsx scripts/package-manager-smoke.ts",
108
+ "verify:update-fixture": "npm run build && tsx scripts/verify-update-fixture.ts",
103
109
  "test:naming-screen": "node --test scripts/naming-screen.test.js",
104
110
  "measure:schema": "tsx scripts/measure-tool-schema.ts",
105
111
  "check:dependency-deprecations": "tsx scripts/check-dependency-deprecations.ts",
@@ -286,6 +286,14 @@ approved and numbered.
286
286
 
287
287
  ### Track B — Parked external-evidence ledger
288
288
 
289
+ Release-governance note (2026-08-15): Knodin has one founder/maintainer. Track B
290
+ remains a historical capability and research ledger, but its external-human,
291
+ multi-custodian, and mandatory three-platform rows are not publication gates.
292
+ Production trust uses a digest-bound maintainer attestation; a release certifies
293
+ only the platforms actually measured, and automatic updates remain disabled on
294
+ unmeasured or unsupported platforms. Technical signature, provenance, rollback,
295
+ channel, and verifier checks remain fail-closed.
296
+
289
297
  Track B parked (10 items, external). The owner parked C60–C67 on 2026-08-02,
290
298
  parked C91 after its code-readiness increment on 2026-08-05, and parked C92
291
299
  and C94 on 2026-08-06 because their acceptance depends on C91 evidence.