akm-cli 0.9.0-rc.4 → 0.9.0-rc.6
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/CHANGELOG.md +122 -26
- package/README.md +7 -7
- package/SECURITY.md +11 -10
- package/dist/akm +2 -2
- package/dist/akm-migrate-storage +2 -2
- package/dist/assets/hints/cli-hints-full.md +60 -73
- package/dist/assets/hints/cli-hints-short.md +8 -12
- package/dist/assets/improve-strategies/default.json +5 -7
- package/dist/assets/improve-strategies/frequent.json +2 -2
- package/dist/assets/improve-strategies/proactive-maintenance.json +2 -2
- package/dist/assets/improve-strategies/quick.json +1 -1
- package/dist/assets/improve-strategies/reflect-distill.json +3 -3
- package/dist/assets/improve-strategies/thorough.json +1 -1
- package/dist/assets/prompts/consolidate-system.md +5 -5
- package/dist/assets/prompts/extract-session.md +2 -6
- package/dist/assets/prompts/reflect-llm-framed-contract.md +11 -0
- package/dist/assets/prompts/reflect-llm-schema-contract.md +3 -0
- package/dist/assets/prompts/reflect-output-repair.md +3 -0
- package/dist/assets/stash-skeleton/README.md +10 -11
- package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +2 -2
- package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +2 -2
- package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +2 -2
- package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +18 -18
- package/dist/assets/stash-skeleton/facts/conventions/domains.md +8 -9
- package/dist/assets/stash-skeleton/facts/conventions/organization.md +13 -15
- package/dist/assets/tasks/core/extract.yml +2 -2
- package/dist/assets/tasks/core/improve.yml +1 -1
- package/dist/assets/templates/html/health.html +2 -3
- package/dist/cli/config-migrate.js +1328 -101
- package/dist/cli/invocation.js +255 -0
- package/dist/cli/parse-args.js +20 -83
- package/dist/cli/shared.js +15 -37
- package/dist/cli.js +18 -49
- package/dist/commands/agent/agent-dispatch.js +2 -2
- package/dist/commands/agent/contribute-cli.js +5 -4
- package/dist/commands/bundle/bundle-cli.js +68 -0
- package/dist/commands/bundle/bundle.js +219 -0
- package/dist/commands/completions.js +2 -2
- package/dist/commands/config-cli.js +6 -3
- package/dist/commands/env/env-binding.js +13 -9
- package/dist/commands/env/env-cli.js +49 -48
- package/dist/commands/env/secret-cli.js +24 -10
- package/dist/commands/events.js +2 -2
- package/dist/commands/feedback-cli.js +59 -33
- package/dist/commands/graph/graph.js +6 -4
- package/dist/commands/health/advisories.js +4 -4
- package/dist/commands/health/html-report.js +190 -593
- package/dist/commands/health/improve-metrics.js +240 -188
- package/dist/commands/health/metrics.js +9 -17
- package/dist/commands/health/report-view-model.js +509 -0
- package/dist/commands/health/surfaces.js +6 -3
- package/dist/commands/health/types-checks.js +4 -0
- package/dist/commands/health/types-improve.js +22 -0
- package/dist/commands/health/types-metrics.js +4 -0
- package/dist/commands/health/types-result.js +7 -0
- package/dist/commands/health/types-runs.js +4 -0
- package/dist/commands/health/types-session-log.js +4 -0
- package/dist/commands/health/types-windows.js +4 -0
- package/dist/commands/health/types.js +26 -21
- package/dist/commands/health/windows.js +1 -2
- package/dist/commands/health.js +219 -161
- package/dist/commands/improve/collapse-detector.js +25 -14
- package/dist/commands/improve/consolidate/chunking.js +7 -5
- package/dist/commands/improve/consolidate.js +640 -740
- package/dist/commands/improve/content-hash.js +39 -0
- package/dist/commands/improve/distill/content-repair.js +4 -10
- package/dist/commands/improve/distill/promote-memory.js +79 -49
- package/dist/commands/improve/distill/quality-gate.js +113 -35
- package/dist/commands/improve/distill-promotion-policy.js +24 -885
- package/dist/commands/improve/distill.js +565 -337
- package/dist/commands/improve/eligibility.js +75 -36
- package/dist/commands/improve/extract-cli.js +6 -6
- package/dist/commands/improve/extract-prompt.js +5 -34
- package/dist/commands/improve/extract.js +526 -357
- package/dist/commands/improve/feedback-valence.js +2 -12
- package/dist/commands/improve/improve-cli.js +11 -20
- package/dist/commands/improve/improve-result-file.js +7 -6
- package/dist/commands/improve/improve-run-types.js +4 -0
- package/dist/commands/improve/improve-strategies.js +3 -9
- package/dist/commands/improve/improve.js +822 -727
- package/dist/commands/improve/locks.js +27 -95
- package/dist/commands/improve/loop-stages.js +941 -963
- package/dist/commands/improve/memory/derived-ref.js +122 -0
- package/dist/commands/improve/memory/memory-contradiction-detect.js +35 -38
- package/dist/commands/improve/memory/memory-improve.js +24 -37
- package/dist/commands/improve/outcome-loop.js +13 -33
- package/dist/commands/improve/preparation.js +889 -691
- package/dist/commands/improve/proactive-maintenance.js +37 -9
- package/dist/commands/improve/proposal-envelope.js +31 -0
- package/dist/commands/improve/reflect.js +974 -588
- package/dist/commands/improve/run-context.js +119 -0
- package/dist/commands/improve/salience.js +8 -4
- package/dist/commands/improve/session-asset.js +7 -3
- package/dist/commands/improve/shared.js +14 -40
- package/dist/commands/improve/source-identity.js +39 -26
- package/dist/commands/improve/triage.js +20 -17
- package/dist/commands/lint/base-linter.js +288 -295
- package/dist/commands/lint/index.js +132 -19
- package/dist/commands/mv-cli.js +257 -234
- package/dist/commands/observability-cli.js +2 -1
- package/dist/commands/proposal/diff-format.js +50 -0
- package/dist/commands/proposal/drain-policies.js +0 -6
- package/dist/commands/proposal/drain.js +17 -16
- package/dist/commands/proposal/proposal-cli.js +40 -77
- package/dist/commands/proposal/proposal-types.js +56 -0
- package/dist/commands/proposal/proposal.js +39 -1
- package/dist/commands/proposal/propose.js +41 -19
- package/dist/commands/proposal/repository.js +566 -486
- package/dist/commands/proposal/validators/proposal-quality-validators.js +22 -6
- package/dist/commands/proposal/validators/proposal-validators.js +6 -5
- package/dist/commands/proposal/validators/proposals.js +5 -4
- package/dist/commands/read/curate.js +50 -28
- package/dist/commands/read/knowledge.js +25 -16
- package/dist/commands/read/remember-cli.js +12 -4
- package/dist/commands/read/search-cli.js +33 -33
- package/dist/commands/read/search.js +68 -55
- package/dist/commands/read/show.js +54 -135
- package/dist/commands/remember.js +7 -5
- package/dist/commands/sources/add-cli.js +10 -24
- package/dist/commands/sources/bundle-config-ops.js +58 -0
- package/dist/commands/sources/history.js +13 -8
- package/dist/commands/sources/info.js +10 -11
- package/dist/commands/sources/init.js +12 -21
- package/dist/commands/sources/installed-stashes.js +151 -138
- package/dist/commands/sources/schema-repair.js +5 -3
- package/dist/commands/sources/self-update.js +9 -7
- package/dist/commands/sources/source-add.js +116 -154
- package/dist/commands/sources/source-clone.js +33 -14
- package/dist/commands/sources/source-manage.js +43 -32
- package/dist/commands/sources/sources-cli.js +12 -7
- package/dist/commands/sources/stash-cli.js +12 -5
- package/dist/commands/sources/stash-skeleton.js +1 -1
- package/dist/commands/tasks/default-tasks.js +13 -13
- package/dist/commands/tasks/tasks-cli.js +3 -3
- package/dist/commands/tasks/tasks.js +71 -31
- package/dist/commands/workflow-cli.js +22 -26
- package/dist/core/action-contributors.js +1 -1
- package/dist/core/activation-policy.js +49 -0
- package/dist/core/adapter/adapters/agent-skills-adapter.js +181 -0
- package/dist/core/adapter/adapters/akm-adapter.js +509 -0
- package/dist/core/adapter/adapters/akm-lint.js +381 -0
- package/dist/core/adapter/adapters/akm-metadata.js +416 -0
- package/dist/core/adapter/adapters/akm-task-adapter.js +150 -0
- package/dist/core/adapter/adapters/akm-workflow-adapter.js +196 -0
- package/dist/core/adapter/adapters/claude-adapter.js +61 -0
- package/dist/core/adapter/adapters/dotenv-adapter.js +187 -0
- package/dist/core/adapter/adapters/generic-files-adapter.js +117 -0
- package/dist/core/adapter/adapters/index.js +80 -0
- package/dist/core/adapter/adapters/llm-wiki-adapter.js +413 -0
- package/dist/core/adapter/adapters/okf-adapter.js +223 -0
- package/dist/core/adapter/adapters/opencode-adapter.js +68 -0
- package/dist/core/adapter/adapters/shared.js +286 -0
- package/dist/core/adapter/adapters/tool-dir-shared.js +212 -0
- package/dist/core/adapter/adapters/website-snapshot-adapter.js +154 -0
- package/dist/core/adapter/bundle-adapter.js +4 -0
- package/dist/core/adapter/recognize-match.js +42 -0
- package/dist/core/adapter/registry.js +56 -0
- package/dist/core/adapter/types.js +4 -0
- package/dist/core/asset/asset-placement.js +229 -0
- package/dist/core/asset/asset-ref.js +107 -78
- package/dist/core/asset/asset-serialize.js +20 -0
- package/dist/core/asset/frontmatter.js +1 -1
- package/dist/core/asset/resolve-ref.js +223 -0
- package/dist/core/asset/stash-meta.js +1 -1
- package/dist/core/common.js +141 -49
- package/dist/core/config/config-io.js +0 -108
- package/dist/core/config/config-schema.js +94 -1039
- package/dist/core/config/config-sources.js +115 -36
- package/dist/core/config/config-types.js +16 -11
- package/dist/core/config/config-walker.js +4 -2
- package/dist/core/config/config.js +21 -26
- package/dist/core/config/engine-semantics.js +0 -4
- package/dist/core/config/schema/embedding.js +38 -0
- package/dist/core/config/schema/engines.js +116 -0
- package/dist/core/config/schema/feedback.js +31 -0
- package/dist/core/config/schema/improve-processes.js +395 -0
- package/dist/core/config/schema/improve.js +76 -0
- package/dist/core/config/schema/index-config.js +183 -0
- package/dist/core/config/schema/output.js +15 -0
- package/dist/core/config/schema/primitives.js +94 -0
- package/dist/core/config/schema/search.js +30 -0
- package/dist/core/config/schema/setup.js +27 -0
- package/dist/core/config/schema/sources-bundles.js +164 -0
- package/dist/core/config/schema/workflow.js +29 -0
- package/dist/core/env-secret-ref.js +113 -8
- package/dist/core/errors.js +1 -1
- package/dist/core/events-types.js +4 -0
- package/dist/core/extra-params.js +1 -0
- package/dist/core/file-change.js +16 -0
- package/dist/core/fs-txn.js +316 -0
- package/dist/core/git-message.js +59 -0
- package/dist/core/improve-result.js +9 -1
- package/dist/core/logs-db.js +1 -1
- package/dist/core/maintenance-barrier.js +16 -0
- package/dist/core/migration-backup.js +332 -160
- package/dist/core/paths.js +3 -6
- package/dist/core/platform.js +10 -0
- package/dist/core/recognition-util.js +130 -0
- package/dist/core/redaction.js +2 -2
- package/dist/core/standards/resolve-standards-context.js +47 -64
- package/dist/core/standards/resolve-type-conventions.js +3 -3
- package/dist/core/state/migrations.js +201 -8
- package/dist/core/state-db.js +38 -2
- package/dist/core/subprocess.js +303 -0
- package/dist/core/time.js +20 -0
- package/dist/core/type-presentation.js +130 -0
- package/dist/core/write-source.js +39 -67
- package/dist/indexer/bundle-identity-guard.js +91 -0
- package/dist/indexer/db/graph-db.js +1 -1
- package/dist/indexer/db/llm-cache.js +1 -1
- package/dist/indexer/ensure-index.js +29 -9
- package/dist/indexer/graph/graph-boost.js +28 -24
- package/dist/indexer/graph/graph-extraction.js +5 -6
- package/dist/indexer/graph/graph-types.js +4 -0
- package/dist/indexer/index-written-assets.js +44 -17
- package/dist/indexer/indexer.js +289 -153
- package/dist/indexer/init.js +18 -25
- package/dist/indexer/installations.js +224 -0
- package/dist/indexer/passes/dir-staleness.js +2 -1
- package/dist/indexer/passes/memory-inference.js +8 -4
- package/dist/indexer/passes/metadata.js +96 -243
- package/dist/indexer/scan/doc-to-entry.js +123 -0
- package/dist/indexer/scan/drain-dir.js +144 -0
- package/dist/indexer/search/db-search.js +171 -99
- package/dist/indexer/search/fts-query.js +1 -1
- package/dist/indexer/search/ranking-contributors.js +57 -7
- package/dist/indexer/search/ranking-types.js +4 -0
- package/dist/indexer/search/ranking.js +31 -6
- package/dist/indexer/search/search-attribution.js +67 -0
- package/dist/indexer/search/search-hit-enrichers.js +30 -40
- package/dist/indexer/search/search-source.js +109 -52
- package/dist/indexer/search/semantic-status.js +4 -1
- package/dist/indexer/usage/unmigrated-vaults-guard.js +2 -1
- package/dist/indexer/usage/usage-events.js +72 -9
- package/dist/indexer/walk/file-context.js +1 -44
- package/dist/indexer/walk/matchers.js +16 -32
- package/dist/indexer/walk/path-resolver.js +6 -5
- package/dist/indexer/walk/walker.js +4 -2
- package/dist/integrations/agent/engine-resolution.js +22 -0
- package/dist/integrations/agent/model-aliases.js +1 -1
- package/dist/integrations/agent/prompts.js +35 -11
- package/dist/integrations/agent/spawn.js +41 -270
- package/dist/integrations/harnesses/aider/agent-builder.js +2 -2
- package/dist/integrations/harnesses/aider/index.js +2 -11
- package/dist/integrations/harnesses/amazonq/agent-builder.js +1 -9
- package/dist/integrations/harnesses/amazonq/index.js +3 -16
- package/dist/integrations/harnesses/claude/config-import.js +1 -3
- package/dist/integrations/harnesses/claude/index.js +1 -12
- package/dist/integrations/harnesses/claude/session-log.js +27 -65
- package/dist/integrations/harnesses/codex/agent-builder.js +1 -2
- package/dist/integrations/harnesses/codex/index.js +2 -12
- package/dist/integrations/harnesses/copilot/agent-builder.js +2 -3
- package/dist/integrations/harnesses/copilot/index.js +1 -12
- package/dist/integrations/harnesses/gemini/agent-builder.js +1 -3
- package/dist/integrations/harnesses/gemini/index.js +1 -12
- package/dist/integrations/harnesses/ids.js +24 -0
- package/dist/integrations/harnesses/index.js +27 -2
- package/dist/integrations/harnesses/opencode/config-import.js +1 -3
- package/dist/integrations/harnesses/opencode/index.js +1 -12
- package/dist/integrations/harnesses/opencode/session-log.js +67 -110
- package/dist/integrations/harnesses/opencode-sdk/harness.js +2 -11
- package/dist/integrations/harnesses/openhands/agent-builder.js +3 -3
- package/dist/integrations/harnesses/openhands/index.js +2 -11
- package/dist/integrations/harnesses/pi/agent-builder.js +3 -11
- package/dist/integrations/harnesses/pi/index.js +3 -15
- package/dist/integrations/harnesses/shared.js +17 -0
- package/dist/integrations/harnesses/types.js +37 -2
- package/dist/integrations/lockfile.js +36 -0
- package/dist/integrations/session-logs/index.js +21 -12
- package/dist/integrations/session-logs/provider-base.js +113 -0
- package/dist/llm/client.js +7 -5
- package/dist/llm/embedders/deterministic.js +2 -2
- package/dist/llm/embedders/remote.js +8 -4
- package/dist/llm/graph-extract.js +7 -2
- package/dist/llm/metadata-enhance.js +43 -26
- package/dist/llm/structured-call.js +15 -7
- package/dist/migrate/legacy/config-source-migration.js +223 -0
- package/dist/migrate/legacy/content-migration.js +305 -0
- package/dist/migrate/legacy/legacy-layout.js +779 -0
- package/dist/migrate/legacy/legacy-paths.js +25 -0
- package/dist/migrate/legacy/legacy-stash-json.js +72 -0
- package/dist/migrate/legacy/proposal-fs-import.js +168 -0
- package/dist/migrate/legacy/task-target-ref-migration.js +272 -0
- package/dist/migrate/legacy/three-db-cutover.js +840 -0
- package/dist/migrate/legacy/workflow-migrations-bodies.js +52 -0
- package/dist/migrate/legacy/workflow-migrations-frozen.js +21 -0
- package/dist/migrate/legacy-ref-grammar.js +209 -0
- package/dist/output/command-registry.js +27 -0
- package/dist/output/html-render.js +11 -16
- package/dist/output/renderers.js +32 -276
- package/dist/output/shapes/passthrough.js +3 -9
- package/dist/output/shapes/registry.js +12 -6
- package/dist/output/text/command-format.js +547 -0
- package/dist/output/text/helpers.js +15 -1377
- package/dist/output/text/proposal-format.js +230 -0
- package/dist/output/text/registry.js +12 -6
- package/dist/output/text/show-directives.js +107 -0
- package/dist/output/text/show-format.js +103 -0
- package/dist/output/text/workflow-format.js +345 -0
- package/dist/output/text.js +1 -3
- package/dist/registry/build-index.js +13 -17
- package/dist/registry/providers/static-index.js +2 -2
- package/dist/registry/resolve.js +4 -90
- package/dist/registry/semver.js +93 -0
- package/dist/runtime.js +90 -0
- package/dist/schemas/akm-config.json +2956 -14890
- package/dist/schemas/akm-task.json +2 -2
- package/dist/schemas/akm-workflow.json +2 -2
- package/dist/scripts/migrate-storage.js +2312 -19642
- package/dist/setup/detect.js +5 -7
- package/dist/setup/engine-config.js +2 -1
- package/dist/setup/registry-stash-loader.js +1 -1
- package/dist/setup/semantic-assets.js +12 -9
- package/dist/setup/setup.js +109 -39
- package/dist/setup/steps/connection-shared.js +120 -0
- package/dist/setup/steps/connection.js +50 -274
- package/dist/setup/steps/platforms.js +1 -0
- package/dist/setup/steps/sources.js +13 -6
- package/dist/setup/steps/stashdir.js +5 -2
- package/dist/sources/freshness.js +39 -0
- package/dist/sources/providers/git-provider.js +29 -33
- package/dist/sources/providers/git-stash.js +10 -5
- package/dist/sources/providers/provider-utils.js +40 -18
- package/dist/sources/providers/website.js +1 -1
- package/dist/sources/resolve.js +5 -5
- package/dist/sources/snapshot-fetchers/types.js +4 -0
- package/dist/sources/{website-ingest.js → snapshot-fetchers/website-ingest.js} +105 -39
- package/dist/storage/database.js +47 -3
- package/dist/storage/engines/sqlite-migrations.js +34 -16
- package/dist/storage/locations.js +1 -2
- package/dist/storage/repositories/improve-runs-repository.js +0 -20
- package/dist/storage/repositories/index-connection.js +80 -0
- package/dist/storage/repositories/index-db.js +4 -3
- package/dist/storage/repositories/index-entries-repository.js +952 -0
- package/dist/{indexer/db/entry-mapper.js → storage/repositories/index-entry-mapper.js} +15 -2
- package/dist/storage/repositories/index-entry-types.js +4 -0
- package/dist/storage/repositories/index-fts-repository.js +164 -0
- package/dist/storage/repositories/index-llm-cache-repository.js +109 -0
- package/dist/storage/repositories/index-meta-repository.js +50 -0
- package/dist/{indexer/db/schema.js → storage/repositories/index-schema.js} +241 -100
- package/dist/storage/repositories/index-sql.js +12 -0
- package/dist/storage/repositories/index-utility-repository.js +369 -0
- package/dist/storage/repositories/index-vec-repository.js +245 -0
- package/dist/storage/repositories/proposals-repository.js +41 -50
- package/dist/storage/repositories/registry-cache.js +1 -1
- package/dist/storage/repositories/workflow-runs-repository.js +17 -11
- package/dist/tasks/backends/cron.js +5 -5
- package/dist/tasks/backends/exec-utils.js +21 -0
- package/dist/tasks/backends/index.js +6 -9
- package/dist/tasks/backends/launchd.js +16 -17
- package/dist/tasks/backends/schtasks.js +33 -41
- package/dist/tasks/backends/types.js +4 -0
- package/dist/tasks/parser.js +25 -5
- package/dist/tasks/runner.js +33 -39
- package/dist/tasks/validator.js +5 -6
- package/dist/workflows/authoring/authoring.js +8 -11
- package/dist/workflows/exec/brief.js +10 -7
- package/dist/workflows/exec/report.js +261 -156
- package/dist/workflows/exec/run-workflow.js +2 -1
- package/dist/workflows/exec/step-work.js +3 -9
- package/dist/workflows/program/parser.js +4 -60
- package/dist/workflows/renderer.js +11 -60
- package/dist/workflows/runtime/checkin.js +1 -1
- package/dist/workflows/runtime/plan-classifier.js +7 -4
- package/dist/workflows/runtime/runs.js +11 -10
- package/dist/workflows/runtime/unit-checkin.js +1 -1
- package/dist/workflows/runtime/unit-phases.js +20 -0
- package/dist/workflows/runtime/workflow-asset-loader.js +27 -16
- package/dist/workflows/validate-summary.js +2 -2
- package/dist/workflows/validator.js +18 -2
- package/docs/migration/release-notes/0.9.0.md +45 -3
- package/docs/migration/v0.8-to-v0.9.md +466 -262
- package/docs/{data-and-telemetry.md → reference/data-and-telemetry.md} +61 -17
- package/package.json +10 -9
- package/schemas/akm-config.json +2956 -14890
- package/schemas/akm-task.json +2 -2
- package/schemas/akm-workflow.json +2 -2
- package/dist/assets/help/help-accept.md +0 -12
- package/dist/assets/help/help-improve.md +0 -84
- package/dist/assets/help/help-proposals.md +0 -17
- package/dist/assets/help/help-propose.md +0 -17
- package/dist/assets/help/help-reject.md +0 -11
- package/dist/assets/improve-strategies/recombine-only.json +0 -23
- package/dist/assets/improve-strategies/synthesize.json +0 -17
- package/dist/assets/prompts/procedural-system.md +0 -44
- package/dist/assets/prompts/recombine-system.md +0 -40
- package/dist/assets/prompts/staleness-detect-system.md +0 -6
- package/dist/assets/templates/html/default.html +0 -78
- package/dist/assets/templates/html/vendor/echarts.min.js +0 -45
- package/dist/assets/wiki/index-template.md +0 -12
- package/dist/assets/wiki/ingest-workflow-template.md +0 -83
- package/dist/assets/wiki/log-template.md +0 -8
- package/dist/assets/wiki/schema-template.md +0 -61
- package/dist/commands/improve/calibration.js +0 -161
- package/dist/commands/improve/dedup.js +0 -482
- package/dist/commands/improve/hot-probation.js +0 -45
- package/dist/commands/improve/improve-auto-accept.js +0 -262
- package/dist/commands/improve/procedural.js +0 -403
- package/dist/commands/improve/recombine.js +0 -843
- package/dist/commands/improve/schema-similarity-gate.js +0 -168
- package/dist/commands/lint/agent-linter.js +0 -44
- package/dist/commands/lint/command-linter.js +0 -44
- package/dist/commands/lint/default-linter.js +0 -16
- package/dist/commands/lint/fact-linter.js +0 -39
- package/dist/commands/lint/knowledge-linter.js +0 -16
- package/dist/commands/lint/memory-linter.js +0 -61
- package/dist/commands/lint/registry.js +0 -41
- package/dist/commands/lint/skill-linter.js +0 -45
- package/dist/commands/lint/task-linter.js +0 -50
- package/dist/commands/lint/workflow-linter.js +0 -81
- package/dist/commands/proposal/legacy-import.js +0 -115
- package/dist/commands/wiki-cli.js +0 -291
- package/dist/core/asset/asset-registry.js +0 -76
- package/dist/core/asset/asset-spec.js +0 -316
- package/dist/core/eval/rank-metrics.js +0 -113
- package/dist/core/ripgrep/install.js +0 -163
- package/dist/core/ripgrep/resolve.js +0 -81
- package/dist/indexer/db/db.js +0 -1585
- package/dist/indexer/manifest.js +0 -170
- package/dist/indexer/passes/metadata-contributors.js +0 -31
- package/dist/integrations/harnesses/opencode-sdk/index.js +0 -25
- package/dist/output/text/wiki.js +0 -16
- package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +0 -18228
- package/dist/scripts/migrations/v16-to-v17.js +0 -141
- package/dist/storage/repositories/consolidation-repository.js +0 -38
- package/dist/storage/repositories/recombine-repository.js +0 -213
- package/dist/wiki/wiki-templates.js +0 -15
- package/dist/wiki/wiki.js +0 -1013
- package/dist/workflows/db.js +0 -413
- package/docs/README.md +0 -103
- package/docs/migration/release-notes/0.9.0-beta.60.md +0 -19
- /package/dist/sources/{wiki-fetchers → snapshot-fetchers}/registry.js +0 -0
- /package/dist/sources/{wiki-fetchers → snapshot-fetchers}/youtube.js +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Catalog of pages in the {{WIKI_NAME}} wiki. Regenerated by `akm index`.
|
|
3
|
-
wikiRole: index
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# {{WIKI_NAME}} — index
|
|
7
|
-
|
|
8
|
-
_This file is regenerated on every `akm index` run. Manual edits are
|
|
9
|
-
preserved until the next regeneration, then replaced._
|
|
10
|
-
|
|
11
|
-
_(no pages yet — create one with your editor, or ingest a source with `akm
|
|
12
|
-
wiki stash {{WIKI_NAME}} <path>`.)_
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# Ingest workflow for wiki:{{WIKI_NAME}}
|
|
2
|
-
|
|
3
|
-
Wiki location: {{WIKI_DIR}}
|
|
4
|
-
Schema: {{SCHEMA_PATH}}
|
|
5
|
-
|
|
6
|
-
Follow these steps. akm commands handle the invariants; use your native
|
|
7
|
-
Read/Write/Edit tools for page edits.
|
|
8
|
-
|
|
9
|
-
This workflow is for ingesting sources that are ALREADY present under
|
|
10
|
-
`{{WIKI_DIR}}/raw/`. Do not ask the user for a source unless the raw queue is
|
|
11
|
-
empty and the caller explicitly asked for interactive ingest.
|
|
12
|
-
|
|
13
|
-
1. **Read the schema.** Open `{{SCHEMA_PATH}}`. It defines the voice, page
|
|
14
|
-
kinds, contradiction policy, and any wiki-specific conventions. Do not
|
|
15
|
-
skip this step even on familiar wikis — the schema may have changed.
|
|
16
|
-
|
|
17
|
-
2. **Discover the pending raw queue.**
|
|
18
|
-
```sh
|
|
19
|
-
akm wiki lint {{WIKI_NAME}}
|
|
20
|
-
```
|
|
21
|
-
Focus on `uncited-raw` findings: those raw files exist under `raw/` but are
|
|
22
|
-
not yet cited by any authored page. Treat each `uncited-raw` finding as a
|
|
23
|
-
pending ingest item, and sort the queue **oldest raw file first** (by
|
|
24
|
-
filename/mtime). Processing oldest-first keeps backlog age bounded even
|
|
25
|
-
when the queue is larger than one run can finish. If there are no
|
|
26
|
-
`uncited-raw` findings, exit cleanly after a final `akm index` +
|
|
27
|
-
`akm wiki lint {{WIKI_NAME}}` verification.
|
|
28
|
-
|
|
29
|
-
Do not read or classify the whole backlog upfront. Work the queue as a
|
|
30
|
-
bounded loop, one raw file at a time: fully finish a raw (read → decide →
|
|
31
|
-
edit → log entry, steps 3-7 below) before looking at the next one. If you
|
|
32
|
-
run low on time partway through a large backlog, stop after finishing your
|
|
33
|
-
current raw — do not start a new one you can't complete. This is expected
|
|
34
|
-
and fine: whatever you already merged is committed to the pages and
|
|
35
|
-
`log.md`, so the next scheduled run picks up where you left off instead of
|
|
36
|
-
redoing this run's work.
|
|
37
|
-
|
|
38
|
-
3. **For the current raw file, read the source and find related pages.**
|
|
39
|
-
Open the raw file directly from `{{WIKI_DIR}}/raw/`.
|
|
40
|
-
|
|
41
|
-
If the file does not read as text (binary content, garbled bytes, e.g. a
|
|
42
|
-
raw PDF byte-dump that was never text-extracted), do not attempt deep
|
|
43
|
-
forensic recovery (no web searches, no `strings`-style dumps). Append a
|
|
44
|
-
one-line `log.md` entry noting it as skipped/unprocessable with a short
|
|
45
|
-
reason, then move on to the next raw in the queue.
|
|
46
|
-
|
|
47
|
-
Otherwise, search for related pages:
|
|
48
|
-
```sh
|
|
49
|
-
akm wiki search {{WIKI_NAME}} "<key terms from the raw source>"
|
|
50
|
-
```
|
|
51
|
-
Read the top hits with `akm show wiki:{{WIKI_NAME}}/pages/<page>`. Use
|
|
52
|
-
`akm show wiki:{{WIKI_NAME}}/pages/<page> toc` for large pages.
|
|
53
|
-
|
|
54
|
-
4. **Decide for each candidate.** For each related page:
|
|
55
|
-
- **Append**: add a section or paragraph under the relevant heading.
|
|
56
|
-
Include the raw source in the page's `sources:` frontmatter list.
|
|
57
|
-
- **Contradict**: note the tension explicitly; don't silently overwrite.
|
|
58
|
-
Follow the schema's contradiction policy.
|
|
59
|
-
- **Skip**: source doesn't add to this page — move on.
|
|
60
|
-
|
|
61
|
-
5. **Create new pages for concepts/entities the source introduces**, under
|
|
62
|
-
`{{WIKI_DIR}}/pages/` (never at the wiki root — only `schema.md`,
|
|
63
|
-
`index.md`, and `log.md` belong there). Each new page must have
|
|
64
|
-
frontmatter with `description`, `pageKind`, `xrefs`, and `sources`.
|
|
65
|
-
Cross-reference with related pages both directions.
|
|
66
|
-
|
|
67
|
-
6. **Update xrefs both ways.** If page A now xrefs page B, page B must xref
|
|
68
|
-
page A. `akm wiki lint {{WIKI_NAME}}` will flag violations.
|
|
69
|
-
|
|
70
|
-
7. **Append to `log.md`.** One entry per processed raw source (ingested or
|
|
71
|
-
skipped-as-unprocessable): date, raw slug, one-line summary, refs to
|
|
72
|
-
created/edited pages. Newest at the top.
|
|
73
|
-
|
|
74
|
-
8. **Regenerate the index + verify.**
|
|
75
|
-
```sh
|
|
76
|
-
akm index
|
|
77
|
-
akm wiki lint {{WIKI_NAME}}
|
|
78
|
-
```
|
|
79
|
-
Resolve any lint findings before calling the ingest done.
|
|
80
|
-
|
|
81
|
-
That's it. `akm` never calls an LLM — reasoning is your job; it just owns
|
|
82
|
-
the invariants (raw immutability, ref validation, index regeneration,
|
|
83
|
-
structural lint).
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Rules that govern this wiki. Read before ingesting, searching, or editing pages.
|
|
3
|
-
wikiRole: schema
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# {{WIKI_NAME}} wiki schema
|
|
7
|
-
|
|
8
|
-
This wiki follows the three-layer pattern:
|
|
9
|
-
|
|
10
|
-
- `raw/` — immutable ingested sources (never edit)
|
|
11
|
-
- `pages/<page>.md` and `pages/<topic>/<page>.md` — agent-authored pages
|
|
12
|
-
- `schema.md` (this file), `index.md`, `log.md` — wiki-level metadata
|
|
13
|
-
|
|
14
|
-
## Page frontmatter
|
|
15
|
-
|
|
16
|
-
Every page should carry frontmatter so akm can index and link it:
|
|
17
|
-
|
|
18
|
-
```yaml
|
|
19
|
-
---
|
|
20
|
-
description: one-sentence summary used in search and lint
|
|
21
|
-
pageKind: entity | concept | question | note | <your-custom-kind>
|
|
22
|
-
xrefs:
|
|
23
|
-
- wiki:{{WIKI_NAME}}/pages/other-page
|
|
24
|
-
sources:
|
|
25
|
-
- raw/<slug>.md
|
|
26
|
-
---
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
`pageKind` accepts any non-empty string. Add new categories freely; they
|
|
30
|
-
will surface in `index.md` as new sections after the next `akm index` run.
|
|
31
|
-
|
|
32
|
-
## Three operations
|
|
33
|
-
|
|
34
|
-
### Ingest
|
|
35
|
-
|
|
36
|
-
1. Copy the new source into `raw/` with `akm wiki stash {{WIKI_NAME}} <path>`.
|
|
37
|
-
2. Find related pages: `akm wiki search {{WIKI_NAME}} "<terms>"`.
|
|
38
|
-
3. For each related page: append a section, note a contradiction, or create a
|
|
39
|
-
new page under `pages/`. Update xrefs on both sides.
|
|
40
|
-
4. Cite the raw source in each touched page's `sources:` frontmatter.
|
|
41
|
-
5. Append one entry to `log.md` describing what was assimilated.
|
|
42
|
-
|
|
43
|
-
### Query
|
|
44
|
-
|
|
45
|
-
1. `akm wiki search {{WIKI_NAME}} "<question>"` — find candidate pages.
|
|
46
|
-
2. `akm show wiki:{{WIKI_NAME}}/pages/<page>` — read the top hits.
|
|
47
|
-
3. Compose the answer from the wiki; cite raw sources only when the wiki
|
|
48
|
-
points at them.
|
|
49
|
-
|
|
50
|
-
### Lint
|
|
51
|
-
|
|
52
|
-
1. `akm wiki lint {{WIKI_NAME}}` — deterministic structural checks.
|
|
53
|
-
2. Resolve each finding: link orphans, fix broken xrefs, add descriptions,
|
|
54
|
-
cite uncited raws, refresh the index.
|
|
55
|
-
|
|
56
|
-
## Hard rules
|
|
57
|
-
|
|
58
|
-
- `raw/` is immutable. Never edit ingested sources.
|
|
59
|
-
- Cross-references must point at pages that actually exist.
|
|
60
|
-
- Prefer appending to an existing page over duplicating one.
|
|
61
|
-
- Cite the raw source id (e.g. `raw/2026-04-foo.md`) when copying claims.
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
-
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
-
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
// Reliability computation
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
/** Number of fixed-width reliability buckets over [0, 1]. */
|
|
8
|
-
export const CALIBRATION_BUCKET_COUNT = 10;
|
|
9
|
-
function roundRate(value) {
|
|
10
|
-
return Number(value.toFixed(4));
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Assign a confidence in [0, 1] to one of {@link CALIBRATION_BUCKET_COUNT}
|
|
14
|
-
* fixed-width buckets. The final bucket is closed on the right so confidence
|
|
15
|
-
* === 1 lands in the top bucket rather than overflowing.
|
|
16
|
-
*/
|
|
17
|
-
function bucketIndex(confidence) {
|
|
18
|
-
const clamped = Math.min(1, Math.max(0, confidence));
|
|
19
|
-
const idx = Math.floor(clamped * CALIBRATION_BUCKET_COUNT);
|
|
20
|
-
return Math.min(CALIBRATION_BUCKET_COUNT - 1, idx);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Compute a deterministic calibration summary from a list of acted-on gate
|
|
24
|
-
* decisions. Pure: identical input always yields identical output, with no
|
|
25
|
-
* dependency on wall-clock time or randomness.
|
|
26
|
-
*/
|
|
27
|
-
export function summarizeCalibration(samples) {
|
|
28
|
-
const buckets = [];
|
|
29
|
-
const bucketCounts = new Array(CALIBRATION_BUCKET_COUNT).fill(0);
|
|
30
|
-
const bucketAccepted = new Array(CALIBRATION_BUCKET_COUNT).fill(0);
|
|
31
|
-
const bucketConfSum = new Array(CALIBRATION_BUCKET_COUNT).fill(0);
|
|
32
|
-
let accepted = 0;
|
|
33
|
-
let confSum = 0;
|
|
34
|
-
for (const sample of samples) {
|
|
35
|
-
const idx = bucketIndex(sample.confidence);
|
|
36
|
-
bucketCounts[idx] = (bucketCounts[idx] ?? 0) + 1;
|
|
37
|
-
bucketConfSum[idx] = (bucketConfSum[idx] ?? 0) + sample.confidence;
|
|
38
|
-
confSum += sample.confidence;
|
|
39
|
-
if (sample.outcome === "auto-accepted") {
|
|
40
|
-
accepted += 1;
|
|
41
|
-
bucketAccepted[idx] = (bucketAccepted[idx] ?? 0) + 1;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const total = samples.length;
|
|
45
|
-
const width = 1 / CALIBRATION_BUCKET_COUNT;
|
|
46
|
-
for (let i = 0; i < CALIBRATION_BUCKET_COUNT; i += 1) {
|
|
47
|
-
const count = bucketCounts[i] ?? 0;
|
|
48
|
-
const acc = bucketAccepted[i] ?? 0;
|
|
49
|
-
buckets.push({
|
|
50
|
-
lower: roundRate(i * width),
|
|
51
|
-
upper: roundRate((i + 1) * width),
|
|
52
|
-
count,
|
|
53
|
-
accepted: acc,
|
|
54
|
-
acceptRate: count > 0 ? roundRate(acc / count) : 0,
|
|
55
|
-
meanConfidence: count > 0 ? roundRate((bucketConfSum[i] ?? 0) / count) : 0,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
const overallAcceptRate = total > 0 ? roundRate(accepted / total) : 0;
|
|
59
|
-
const meanConfidence = total > 0 ? roundRate(confSum / total) : 0;
|
|
60
|
-
return {
|
|
61
|
-
samples: total,
|
|
62
|
-
accepted,
|
|
63
|
-
rejected: total - accepted,
|
|
64
|
-
overallAcceptRate,
|
|
65
|
-
meanConfidence,
|
|
66
|
-
calibrationGap: total > 0 ? roundRate(meanConfidence - overallAcceptRate) : 0,
|
|
67
|
-
buckets,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Project a list of `gateDecision` records (read from the proposal store) into
|
|
72
|
-
* the acted-on calibration samples within an optional `[since, until)` window.
|
|
73
|
-
*
|
|
74
|
-
* Only `auto-accepted` / `auto-rejected` decisions with a finite confidence in
|
|
75
|
-
* [0, 1] contribute. `deferred` decisions and decisions missing a confidence
|
|
76
|
-
* are excluded (no realized accept/reject signal). The window filter uses each
|
|
77
|
-
* decision's `decidedAt` timestamp; decisions with an unparseable timestamp are
|
|
78
|
-
* kept only when no window is supplied.
|
|
79
|
-
*
|
|
80
|
-
* Exploration-budget promotions (`reason === "exploration-budget"`) are EXCLUDED:
|
|
81
|
-
* they are accepted regardless of confidence, so they carry no reliability signal
|
|
82
|
-
* about the gate threshold. Counting them would inflate the apparent accept-rate
|
|
83
|
-
* and bias the auto-tuner downward — they are exempt from auto-tune by design
|
|
84
|
-
* (WS-4 exploration budget).
|
|
85
|
-
*/
|
|
86
|
-
export function gateDecisionsToSamples(decisions, window) {
|
|
87
|
-
const sinceMs = window?.since ? new Date(window.since).getTime() : undefined;
|
|
88
|
-
const untilMs = window?.until ? new Date(window.until).getTime() : undefined;
|
|
89
|
-
const samples = [];
|
|
90
|
-
for (const decision of decisions) {
|
|
91
|
-
if (!decision)
|
|
92
|
-
continue;
|
|
93
|
-
if (decision.outcome !== "auto-accepted" && decision.outcome !== "auto-rejected")
|
|
94
|
-
continue;
|
|
95
|
-
if (decision.reason === "exploration-budget")
|
|
96
|
-
continue;
|
|
97
|
-
const confidence = decision.confidence;
|
|
98
|
-
if (typeof confidence !== "number" || !Number.isFinite(confidence) || confidence < 0 || confidence > 1)
|
|
99
|
-
continue;
|
|
100
|
-
if (sinceMs !== undefined || untilMs !== undefined) {
|
|
101
|
-
const ts = new Date(decision.decidedAt).getTime();
|
|
102
|
-
if (!Number.isFinite(ts))
|
|
103
|
-
continue;
|
|
104
|
-
if (sinceMs !== undefined && ts < sinceMs)
|
|
105
|
-
continue;
|
|
106
|
-
if (untilMs !== undefined && ts >= untilMs)
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
samples.push({ confidence, outcome: decision.outcome });
|
|
110
|
-
}
|
|
111
|
-
return samples;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Compute a bounded, opt-in threshold adjustment from a calibration summary.
|
|
115
|
-
* PURE and deterministic — does not mutate config or read the clock. The
|
|
116
|
-
* caller is responsible for persisting `newThreshold` and logging the result.
|
|
117
|
-
*
|
|
118
|
-
* Algorithm (deliberately simple and bounded):
|
|
119
|
-
* - When `autoTune` is false → no-op (`disabled`).
|
|
120
|
-
* - When samples < `minSamples` → no-op (`insufficient-samples`).
|
|
121
|
-
* - Otherwise nudge by at most `maxStep` toward `targetAcceptRate`, then
|
|
122
|
-
* clamp into `[minThreshold, maxThreshold]`. The step size scales with the
|
|
123
|
-
* gap from target but is capped, so a single run can never make a large
|
|
124
|
-
* swing.
|
|
125
|
-
*/
|
|
126
|
-
export function computeThresholdAutoTune(currentThreshold, summary, config) {
|
|
127
|
-
const previousThreshold = Math.round(currentThreshold);
|
|
128
|
-
const noop = (reason) => ({
|
|
129
|
-
adjusted: false,
|
|
130
|
-
previousThreshold,
|
|
131
|
-
newThreshold: previousThreshold,
|
|
132
|
-
delta: 0,
|
|
133
|
-
reason,
|
|
134
|
-
});
|
|
135
|
-
if (!config.autoTune)
|
|
136
|
-
return noop("disabled");
|
|
137
|
-
if (summary.samples < config.minSamples)
|
|
138
|
-
return noop("insufficient-samples");
|
|
139
|
-
const gap = config.targetAcceptRate - summary.overallAcceptRate;
|
|
140
|
-
// A small dead-band so tiny noise doesn't churn the threshold every run.
|
|
141
|
-
const DEAD_BAND = 0.01;
|
|
142
|
-
if (Math.abs(gap) <= DEAD_BAND)
|
|
143
|
-
return noop("within-target");
|
|
144
|
-
// gap > 0 ⇒ realized below target ⇒ raise threshold (be stricter).
|
|
145
|
-
// gap < 0 ⇒ realized above target ⇒ lower threshold (be more permissive).
|
|
146
|
-
const direction = gap > 0 ? 1 : -1;
|
|
147
|
-
// Scale the step with the gap magnitude (in points) but cap at maxStep.
|
|
148
|
-
const desiredMagnitude = Math.min(config.maxStep, Math.max(1, Math.round(Math.abs(gap) * 100)));
|
|
149
|
-
const proposed = previousThreshold + direction * desiredMagnitude;
|
|
150
|
-
const clamped = Math.min(config.maxThreshold, Math.max(config.minThreshold, proposed));
|
|
151
|
-
const delta = clamped - previousThreshold;
|
|
152
|
-
if (delta === 0)
|
|
153
|
-
return noop("clamped-at-bound");
|
|
154
|
-
return {
|
|
155
|
-
adjusted: true,
|
|
156
|
-
previousThreshold,
|
|
157
|
-
newThreshold: clamped,
|
|
158
|
-
delta,
|
|
159
|
-
reason: direction > 0 ? "below-target-raise" : "above-target-lower",
|
|
160
|
-
};
|
|
161
|
-
}
|