akm-cli 0.9.0 → 0.9.1-beta.2
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 +724 -0
- package/README.md +28 -63
- package/STABILITY.md +4 -2
- package/dist/cli/parse-args.js +7 -1
- package/dist/commands/agent/contribute-cli.js +1 -1
- package/dist/commands/env/child-env.js +14 -0
- package/dist/commands/feedback-cli.js +7 -1
- package/dist/commands/health/llm-usage.js +2 -1
- package/dist/commands/health/surfaces.js +4 -77
- package/dist/commands/health.js +65 -11
- package/dist/commands/improve/distill/quality-gate.js +6 -1
- package/dist/commands/improve/eligibility.js +7 -1
- package/dist/commands/improve/eval-cases.js +2 -0
- package/dist/commands/improve/improve.js +126 -10
- package/dist/commands/improve/locks.js +7 -0
- package/dist/commands/improve/memory/memory-improve.js +9 -0
- package/dist/commands/improve/run-context.js +5 -0
- package/dist/commands/improve/session-asset.js +4 -0
- package/dist/commands/lint/base-linter.js +31 -7
- package/dist/commands/lint/index.js +205 -51
- package/dist/commands/lint/types.js +22 -1
- package/dist/commands/proposal/repository.js +17 -1
- package/dist/commands/sources/add-cli.js +8 -2
- package/dist/commands/sources/info.js +12 -2
- package/dist/commands/sources/installed-stashes.js +6 -1
- package/dist/commands/sources/migration-help.js +12 -3
- package/dist/commands/sources/self-update.js +9 -1
- package/dist/commands/tasks/tasks.js +8 -2
- package/dist/commands/workflow-cli.js +17 -11
- package/dist/core/abort-deadline.js +28 -0
- package/dist/core/adapter/adapters/agent-skills-adapter.js +83 -5
- package/dist/core/adapter/adapters/akm-adapter.js +13 -10
- package/dist/core/adapter/adapters/akm-lint.js +78 -22
- package/dist/core/adapter/adapters/akm-task-adapter.js +43 -20
- package/dist/core/adapter/adapters/dotenv-adapter.js +21 -0
- package/dist/core/adapter/adapters/tool-dir-shared.js +5 -3
- package/dist/core/asset/frontmatter.js +10 -1
- package/dist/core/common.js +147 -9
- package/dist/core/concurrent.js +32 -0
- package/dist/core/config/config-io.js +5 -45
- package/dist/core/config/schema/engines.js +14 -3
- package/dist/core/config/schema/workflow.js +11 -0
- package/dist/core/errors.js +25 -0
- package/dist/core/events.js +30 -24
- package/dist/core/extra-params.js +11 -0
- package/dist/core/file-lock.js +7 -1
- package/dist/core/fs-txn.js +15 -2
- package/dist/core/improve-result.js +5 -0
- package/dist/core/json-schema.js +344 -9
- package/dist/core/loopback.js +89 -0
- package/dist/core/migration-operation.js +17 -2
- package/dist/core/path-access.js +107 -0
- package/dist/core/paths.js +16 -2
- package/dist/core/redaction.js +86 -18
- package/dist/core/spawn-env.js +234 -0
- package/dist/core/state-db-scope.js +134 -0
- package/dist/core/state-db.js +1 -0
- package/dist/core/subprocess.js +181 -37
- package/dist/core/write-provenance.js +85 -0
- package/dist/core/write-source.js +33 -2
- package/dist/indexer/db/graph-db.js +17 -6
- package/dist/indexer/ensure-index.js +10 -3
- package/dist/indexer/index-written-assets.js +17 -2
- package/dist/indexer/indexer.js +86 -21
- package/dist/indexer/passes/memory-inference.js +4 -0
- package/dist/indexer/search/db-search.js +25 -17
- package/dist/indexer/walk/walker.js +6 -1
- package/dist/integrations/agent/detect.js +13 -1
- package/dist/integrations/agent/engine-resolution.js +24 -11
- package/dist/integrations/agent/model-aliases.js +1 -1
- package/dist/integrations/agent/profiles.js +9 -1
- package/dist/integrations/agent/spawn.js +15 -87
- package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +21 -0
- package/dist/integrations/lockfile.js +55 -2
- package/dist/llm/client.js +14 -19
- package/dist/llm/embedder.js +23 -3
- package/dist/llm/embedders/remote.js +27 -2
- package/dist/output/html-render.js +40 -1
- package/dist/output/text/lint-format.js +17 -4
- package/dist/runtime.js +23 -1
- package/dist/scripts/akm-migrate-node.js +1714 -836
- package/dist/scripts/akm-migrate.js +1682 -804
- package/dist/setup/setup.js +22 -7
- package/dist/sources/providers/git-install.js +25 -2
- package/dist/sources/providers/git-stash.js +19 -0
- package/dist/sources/providers/git.js +1 -1
- package/dist/sources/snapshot-fetchers/content-extract.js +63 -1
- package/dist/sources/snapshot-fetchers/website-ingest.js +126 -20
- package/dist/storage/database.js +71 -7
- package/dist/storage/engines/sqlite-migrations.js +61 -2
- package/dist/storage/managed-db.js +19 -0
- package/dist/storage/repositories/index-connection.js +39 -4
- package/dist/storage/repositories/index-entries-repository.js +6 -1
- package/dist/storage/repositories/index-meta-repository.js +11 -0
- package/dist/storage/repositories/index-schema.js +17 -2
- package/dist/storage/repositories/index-vec-repository.js +43 -5
- package/dist/storage/repositories/workflow-runs-repository.js +66 -13
- package/dist/storage/sqlite-pragmas.js +12 -1
- package/dist/tasks/log-redaction.js +156 -0
- package/dist/tasks/parser.js +82 -5
- package/dist/tasks/runner.js +222 -17
- package/dist/tasks/scheduler-invocation.js +19 -0
- package/dist/tasks/schema.js +86 -1
- package/dist/text-import-hook.mjs +1 -1
- package/dist/workflows/concurrency-policy.js +95 -1
- package/dist/workflows/exec/dispatch-redaction.js +114 -0
- package/dist/workflows/exec/exec-unit.js +542 -0
- package/dist/workflows/exec/frozen-judge.js +114 -42
- package/dist/workflows/exec/native-executor.js +465 -238
- package/dist/workflows/exec/param-secrets.js +4 -3
- package/dist/workflows/exec/run-workflow.js +424 -219
- package/dist/workflows/exec/step-work.js +506 -167
- package/dist/workflows/exec/unit-dispatch.js +31 -1
- package/dist/workflows/exec/unit-writer.js +53 -13
- package/dist/workflows/exec/worktree.js +454 -41
- package/dist/workflows/ir/compile.js +26 -2
- package/dist/workflows/ir/freeze.js +82 -15
- package/dist/workflows/ir/schema.js +105 -20
- package/dist/workflows/parser.js +242 -19
- package/dist/workflows/program/schema.js +24 -0
- package/dist/workflows/renderer.js +32 -4
- package/dist/workflows/resource-limits.js +182 -0
- package/dist/workflows/runtime/runs.js +146 -6
- package/dist/workflows/validate-summary.js +17 -2
- package/docs/README.md +74 -32
- package/docs/migration/release-notes/0.9.0.md +2 -1
- package/docs/migration/v0.7-to-v0.8.md +2 -1
- package/docs/migration/v0.8-to-v0.9.md +3 -1
- package/docs/reference/README.md +11 -4
- package/docs/reference/bundle-types.md +19 -0
- package/docs/reference/cli.md +105 -16
- package/docs/reference/configuration.md +15 -2
- package/docs/reference/data-and-telemetry.md +30 -10
- package/docs/reference/supported-formats.md +50 -0
- package/docs/reference/workflow-schema.md +1014 -0
- package/docs/reference/workflows.md +37 -633
- package/package.json +13 -6
- package/schemas/akm-config.json +18 -5
- package/schemas/akm-task.json +27 -5
- package/schemas/akm-workflow.json +92 -13
|
@@ -17,14 +17,22 @@ import { compileResolveFreezeWorkflow } from "../ir/freeze.js";
|
|
|
17
17
|
import { materializeWorkflowParameterFlags, validateWorkflowParams } from "../ir/params.js";
|
|
18
18
|
import { canonicalPlanJson, computePlanHash } from "../ir/plan-hash.js";
|
|
19
19
|
import { decodeWorkflowPlanV3, WORKFLOW_IR_VERSION } from "../ir/schema.js";
|
|
20
|
+
import { clip, utf8Bytes, WORKFLOW_EVIDENCE_TRUNCATION_PREVIEW_CHARS, WORKFLOW_MAX_EVIDENCE_JSON_BYTES, WORKFLOW_UNIT_DIAGNOSTIC_CLIP, } from "../resource-limits.js";
|
|
20
21
|
import { validateStepSummary } from "../validate-summary.js";
|
|
21
22
|
import { resolveAgentIdentity } from "./agent-identity.js";
|
|
22
23
|
import { evaluateCheckin } from "./checkin.js";
|
|
23
24
|
import { assertWorkflowSpineMatchesPlan, classifyWorkflowRunPlan, frozenStepRows, requireExecutableWorkflowPlan, } from "./plan-classifier.js";
|
|
24
25
|
import { evaluateStaleUnits } from "./unit-checkin.js";
|
|
25
26
|
import { canonicalizeWorkflowRefInput, loadWorkflowAsset, resolveWorkflowEntryId } from "./workflow-asset-loader.js";
|
|
26
|
-
/**
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Membership test for the journaled `runner` column, which is an untyped string.
|
|
29
|
+
* The `Record<IrRuntimeKind, …>` is exhaustiveness-checked, so a new runtime
|
|
30
|
+
* kind cannot be added to the union without being accepted here too.
|
|
31
|
+
*/
|
|
32
|
+
const IR_RUNTIME_KINDS = { llm: true, agent: true, sdk: true, exec: true };
|
|
33
|
+
function runtimeKindOf(runner) {
|
|
34
|
+
return runner !== null && Object.hasOwn(IR_RUNTIME_KINDS, runner) ? runner : null;
|
|
35
|
+
}
|
|
28
36
|
function toUnitDiagnostic(row, stale, plannedEngine) {
|
|
29
37
|
let diagnostic = null;
|
|
30
38
|
if (row.result_json !== null) {
|
|
@@ -40,7 +48,7 @@ function toUnitDiagnostic(row, stale, plannedEngine) {
|
|
|
40
48
|
catch {
|
|
41
49
|
/* leave the raw journaled text */
|
|
42
50
|
}
|
|
43
|
-
diagnostic = text
|
|
51
|
+
diagnostic = clip(text, WORKFLOW_UNIT_DIAGNOSTIC_CLIP);
|
|
44
52
|
}
|
|
45
53
|
return {
|
|
46
54
|
unitId: row.unit_id,
|
|
@@ -60,7 +68,7 @@ function toUnitDiagnostic(row, stale, plannedEngine) {
|
|
|
60
68
|
claimHolder: row.claim_holder,
|
|
61
69
|
claimExpiresAt: row.claim_expires_at,
|
|
62
70
|
engine: row.engine ?? null,
|
|
63
|
-
runtimeKind:
|
|
71
|
+
runtimeKind: runtimeKindOf(row.runner),
|
|
64
72
|
platform: plannedEngine?.kind === "agent" ? plannedEngine.platform : null,
|
|
65
73
|
};
|
|
66
74
|
}
|
|
@@ -350,6 +358,116 @@ export async function abandonWorkflowRun(runId) {
|
|
|
350
358
|
return detail;
|
|
351
359
|
});
|
|
352
360
|
}
|
|
361
|
+
// ── Step-evidence persistence bound (issue C) ────────────────────────────────
|
|
362
|
+
/**
|
|
363
|
+
* Marker key stamped on every value this module replaced because it did not fit
|
|
364
|
+
* in `workflow_run_steps.evidence_json`. It is deliberately ugly and unique so a
|
|
365
|
+
* truncated value can NEVER be mistaken for real workflow data by a downstream
|
|
366
|
+
* `steps.<id>.output…` reference, by `akm workflow status`, or by a human
|
|
367
|
+
* reading the row.
|
|
368
|
+
*/
|
|
369
|
+
export const WORKFLOW_EVIDENCE_TRUNCATED_MARKER = "__akm_evidence_truncated__";
|
|
370
|
+
function truncatedEvidenceValue(json, what, limitBytes, withPreview) {
|
|
371
|
+
return {
|
|
372
|
+
[WORKFLOW_EVIDENCE_TRUNCATED_MARKER]: true,
|
|
373
|
+
reason: `${what} exceeded the ${limitBytes}-byte evidence_json persistence cap and was NOT stored. ` +
|
|
374
|
+
`The complete value existed only in the live step result; it cannot be recovered from this row. ` +
|
|
375
|
+
`Reduce the step's fan-out or have it emit a reference (path, id) instead of inline bulk data.`,
|
|
376
|
+
originalBytes: utf8Bytes(json),
|
|
377
|
+
limitBytes,
|
|
378
|
+
...(withPreview ? { preview: json.slice(0, WORKFLOW_EVIDENCE_TRUNCATION_PREVIEW_CHARS) } : {}),
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* True when `value` is the {@link TruncatedEvidenceValue} envelope persisted in
|
|
383
|
+
* place of an over-cap evidence entry.
|
|
384
|
+
*
|
|
385
|
+
* A LIVE invocation never sees one: the engine threads each step's complete
|
|
386
|
+
* in-memory evidence to the rest of its own run. A RESUMED invocation rebuilds
|
|
387
|
+
* the downstream scope from these rows, so `exec/step-work.ts` tests every
|
|
388
|
+
* whole-value reference with this predicate — otherwise a reference INTO the
|
|
389
|
+
* envelope reports a generic missing property and a reference AT it silently
|
|
390
|
+
* hands the envelope to a unit as if it were the artifact.
|
|
391
|
+
*/
|
|
392
|
+
export function isTruncatedEvidence(value) {
|
|
393
|
+
return (typeof value === "object" &&
|
|
394
|
+
value !== null &&
|
|
395
|
+
value[WORKFLOW_EVIDENCE_TRUNCATED_MARKER] === true);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Bound what a step's evidence costs in ONE SQLite row.
|
|
399
|
+
*
|
|
400
|
+
* `buildEvidence` (exec/step-work.ts) promotes `evidence.output` UNCLIPPED by
|
|
401
|
+
* design: gates judge the full promoted artifact and the in-memory
|
|
402
|
+
* {@link StepExecutionResult} carries it to the caller intact. Nothing bounded
|
|
403
|
+
* the PERSISTED form, though — a `collect` reducer over a fan-out capped only by
|
|
404
|
+
* `WORKFLOW_MAX_MAP_EXPANSION` (10 000 units) can serialize to hundreds of
|
|
405
|
+
* megabytes. This is the write boundary, so the bound lives here rather than in
|
|
406
|
+
* the shared step-semantics module.
|
|
407
|
+
*
|
|
408
|
+
* Over-cap values are REPLACED (largest top-level entry BY UTF-8 BYTES first —
|
|
409
|
+
* the unit the cap is measured in — until the row fits) with a
|
|
410
|
+
* {@link TruncatedEvidenceValue} envelope. Nothing is silently shortened: a
|
|
411
|
+
* consumer either sees the real value or sees an object whose marker key says
|
|
412
|
+
* the data is gone. `preview` is intentionally not shaped like the original, so
|
|
413
|
+
* an expression reaching INTO a truncated artifact (`steps.x.output.files`)
|
|
414
|
+
* cannot quietly resolve against a half-array; a resumed run's reference is
|
|
415
|
+
* rejected by name through {@link isTruncatedEvidence}.
|
|
416
|
+
*
|
|
417
|
+
* Returns the JSON to persist plus the keys that were replaced (empty in the
|
|
418
|
+
* overwhelmingly common case, where nothing is copied or re-serialized twice).
|
|
419
|
+
*/
|
|
420
|
+
export function clipStepEvidenceForPersistence(evidence, limitBytes = WORKFLOW_MAX_EVIDENCE_JSON_BYTES) {
|
|
421
|
+
if (!evidence)
|
|
422
|
+
return { json: null, truncatedKeys: [] };
|
|
423
|
+
// Throws exactly as the previous inline `JSON.stringify` did on unserializable
|
|
424
|
+
// evidence — that contract is unchanged. Every stringify below operates on a
|
|
425
|
+
// subtree of a value already proven serializable here.
|
|
426
|
+
let json = JSON.stringify(evidence);
|
|
427
|
+
if (json === undefined)
|
|
428
|
+
return { json: null, truncatedKeys: [] };
|
|
429
|
+
let bytes = utf8Bytes(json);
|
|
430
|
+
if (bytes <= limitBytes)
|
|
431
|
+
return { json, truncatedKeys: [] };
|
|
432
|
+
const clipped = { ...evidence };
|
|
433
|
+
const truncatedKeys = [];
|
|
434
|
+
// Ordered by UTF-8 BYTES, the unit the cap itself is measured in: ordering by
|
|
435
|
+
// `json.length` (UTF-16 code units) sacrifices the char-largest key rather
|
|
436
|
+
// than the byte-largest one, so multibyte-heavy evidence loses extra keys the
|
|
437
|
+
// cap never required.
|
|
438
|
+
const bySizeDesc = Object.keys(evidence)
|
|
439
|
+
.map((key) => {
|
|
440
|
+
const json = JSON.stringify(evidence[key]) ?? "null";
|
|
441
|
+
return { key, json, bytes: utf8Bytes(json) };
|
|
442
|
+
})
|
|
443
|
+
.sort((a, b) => b.bytes - a.bytes);
|
|
444
|
+
for (const [index, entry] of bySizeDesc.entries()) {
|
|
445
|
+
const envelope = truncatedEvidenceValue(entry.json, `Step evidence "${entry.key}"`, limitBytes, true);
|
|
446
|
+
clipped[entry.key] = envelope;
|
|
447
|
+
truncatedKeys.push(entry.key);
|
|
448
|
+
// Track the row size arithmetically from the per-key sizes already computed
|
|
449
|
+
// for the sort, so a run of replacements costs ONE whole-object
|
|
450
|
+
// serialization rather than one per replaced key. The total is an ESTIMATE
|
|
451
|
+
// — a key whose value is `undefined` is charged the `"null"` the sort used
|
|
452
|
+
// but is OMITTED from the serialized row — so it decides only WHEN to
|
|
453
|
+
// measure. Whether the row FITS is settled by an exact serialization every
|
|
454
|
+
// time, the last key included, so an exhausted loop falls through to the
|
|
455
|
+
// whole-object marker on measurement rather than on drift.
|
|
456
|
+
bytes += utf8Bytes(JSON.stringify(envelope)) - entry.bytes;
|
|
457
|
+
if (bytes > limitBytes && index < bySizeDesc.length - 1)
|
|
458
|
+
continue;
|
|
459
|
+
json = JSON.stringify(clipped);
|
|
460
|
+
bytes = utf8Bytes(json);
|
|
461
|
+
if (bytes <= limitBytes)
|
|
462
|
+
return { json, truncatedKeys };
|
|
463
|
+
}
|
|
464
|
+
// Pathological shape (so many keys that even the envelopes overflow): persist
|
|
465
|
+
// ONE whole-object marker. Still unambiguous, still bounded.
|
|
466
|
+
return {
|
|
467
|
+
json: JSON.stringify(truncatedEvidenceValue(JSON.stringify(evidence), "Step evidence", limitBytes, false)),
|
|
468
|
+
truncatedKeys: Object.keys(evidence),
|
|
469
|
+
};
|
|
470
|
+
}
|
|
353
471
|
export async function completeWorkflowStep(input) {
|
|
354
472
|
// Read the step (read-only) up front so the LLM validation gate runs OUTSIDE
|
|
355
473
|
// the write transaction — a slow/hung LLM must never hold a db write lock.
|
|
@@ -389,7 +507,13 @@ export async function completeWorkflowStep(input) {
|
|
|
389
507
|
if (input.signal?.aborted)
|
|
390
508
|
throw interruptionReason(input.signal);
|
|
391
509
|
const judge = input.summaryJudge === undefined
|
|
392
|
-
?
|
|
510
|
+
? // Manual completion journals no gate row, so there is no `<stepId>.gate:l<loop>`
|
|
511
|
+
// identity to agree with — but the dispatch still names the REAL run and
|
|
512
|
+
// step (frozen-judge falls back to the gate node id for the unit id).
|
|
513
|
+
frozenSummaryJudge(preflight.plan, preflight.stepPlan.gate.judge, input.signal, undefined, {
|
|
514
|
+
runId: input.runId,
|
|
515
|
+
stepId: input.stepId,
|
|
516
|
+
})
|
|
393
517
|
: input.summaryJudge;
|
|
394
518
|
if (criteria.length > 0 && !judge) {
|
|
395
519
|
throw new ConfigError(`Workflow run ${input.runId} has completion criteria for step "${input.stepId}" but its frozen plan has no judge. ` +
|
|
@@ -441,10 +565,26 @@ export async function completeWorkflowStep(input) {
|
|
|
441
565
|
if (input.signal?.aborted)
|
|
442
566
|
throw interruptionReason(input.signal);
|
|
443
567
|
const completedAt = new Date().toISOString();
|
|
568
|
+
// Bound the single-row cost of the promoted artifact (issue C). The
|
|
569
|
+
// caller's in-memory evidence object is never mutated — a clipped COPY is
|
|
570
|
+
// serialized — so the live step result and the gate's artifact judging
|
|
571
|
+
// keep the complete value. The DOWNSTREAM scope keeps it only because the
|
|
572
|
+
// engine threads this same in-memory evidence forward (`driveRun` prefers
|
|
573
|
+
// it over the re-read row): what the clip actually costs is a LATER
|
|
574
|
+
// invocation, which has nothing but these rows to rebuild the scope from.
|
|
575
|
+
const persistedEvidence = clipStepEvidenceForPersistence(input.evidence);
|
|
576
|
+
if (persistedEvidence.truncatedKeys.length > 0) {
|
|
577
|
+
warn(`Workflow run ${run.id} step "${input.stepId}": evidence exceeded the ` +
|
|
578
|
+
`${WORKFLOW_MAX_EVIDENCE_JSON_BYTES}-byte persistence cap; ` +
|
|
579
|
+
`${persistedEvidence.truncatedKeys.map((k) => `"${k}"`).join(", ")} ` +
|
|
580
|
+
`${persistedEvidence.truncatedKeys.length === 1 ? "was" : "were"} stored as a truncation marker. ` +
|
|
581
|
+
`The rest of THIS invocation still reads the complete value, but a run resumed from these rows will ` +
|
|
582
|
+
`fail loudly when a later step references this step's output rather than read partial data.`);
|
|
583
|
+
}
|
|
444
584
|
repo.updateStepCompletion({
|
|
445
585
|
status: input.status,
|
|
446
586
|
notes: input.notes?.trim() || null,
|
|
447
|
-
evidenceJson:
|
|
587
|
+
evidenceJson: persistedEvidence.json,
|
|
448
588
|
summary: summary || null,
|
|
449
589
|
completedAt,
|
|
450
590
|
runId: run.id,
|
|
@@ -17,6 +17,21 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import validateSummaryJudgePrompt from "../assets/prompts/validate-summary-judge.md" with { type: "text" };
|
|
19
19
|
import { parseJsonResponse } from "../core/parse.js";
|
|
20
|
+
/**
|
|
21
|
+
* Parse the judge's raw response into a well-formed verdict, or `undefined`
|
|
22
|
+
* when the response is malformed (unparseable, or missing a boolean
|
|
23
|
+
* `complete`). This is the ONE verdict parser: {@link validateStepSummary}
|
|
24
|
+
* fails closed through it, and the engine's gate wrapper (step-work.ts) uses
|
|
25
|
+
* the same function to classify a malformed verdict as verifier
|
|
26
|
+
* INFRASTRUCTURE failure — never an honest rejection that would consume a
|
|
27
|
+
* gate loop — so the two classifications cannot drift.
|
|
28
|
+
*/
|
|
29
|
+
export function parseJudgeVerdict(raw) {
|
|
30
|
+
const parsed = parseJsonResponse(raw);
|
|
31
|
+
if (!parsed || typeof parsed.complete !== "boolean")
|
|
32
|
+
return undefined;
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
20
35
|
const JUDGE_SYSTEM = validateSummaryJudgePrompt;
|
|
21
36
|
function buildUserPrompt(input) {
|
|
22
37
|
const criteria = input.completionCriteria.map((c, i) => `${i + 1}. ${c}`).join("\n");
|
|
@@ -67,8 +82,8 @@ export async function validateStepSummary(input, judge, signal) {
|
|
|
67
82
|
feedback: "The verification judge failed. Retry after fixing the verifier configuration or service.",
|
|
68
83
|
};
|
|
69
84
|
}
|
|
70
|
-
const parsed =
|
|
71
|
-
if (!parsed
|
|
85
|
+
const parsed = parseJudgeVerdict(raw);
|
|
86
|
+
if (!parsed) {
|
|
72
87
|
return {
|
|
73
88
|
complete: false,
|
|
74
89
|
missing: criteria,
|
package/docs/README.md
CHANGED
|
@@ -1,61 +1,103 @@
|
|
|
1
1
|
# Documentation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AKM is a portable capability library for AI agents: one library for every
|
|
4
|
+
agent. This hub is organized by what you're trying to do, not by directory —
|
|
5
|
+
start here, then follow links out to the guides, reference, and architecture
|
|
6
|
+
pages as you need more depth. Each subdirectory also has its own README
|
|
7
|
+
indexing everything inside it.
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
Full per-directory indexes: [Guides](https://github.com/itlackey/akm/blob/main/docs/guides/README.md),
|
|
10
|
+
[Reference](reference/README.md), [Agents](https://github.com/itlackey/akm/blob/main/docs/agents/README.md),
|
|
11
|
+
[Architecture](https://github.com/itlackey/akm/blob/main/docs/architecture/README.md), [Migration](migration/README.md).
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
## Start
|
|
8
14
|
|
|
9
|
-
- [Getting Started](https://github.com/itlackey/akm/blob/main/docs/guides/getting-started.md) --
|
|
10
|
-
- [Concepts](https://github.com/itlackey/akm/blob/main/docs/guides/concepts.md) --
|
|
11
|
-
- [
|
|
15
|
+
- [Getting Started](https://github.com/itlackey/akm/blob/main/docs/guides/getting-started.md) -- Install akm, connect a source, and pull a curated shortlist in five to seven minutes
|
|
16
|
+
- [Concepts](https://github.com/itlackey/akm/blob/main/docs/guides/concepts.md) -- Capabilities, bundles, adapters, asset types, and refs -- the mental model in one page
|
|
17
|
+
- [Agent Install Guide](https://github.com/itlackey/akm/blob/main/docs/agents/agent-install.md) -- Step-by-step automated (non-interactive) install for agents
|
|
18
|
+
- `akm help agents` (short guide by default; `akm help agents --full` for the complete guide) -- The CLI reference agents load to use akm; always the embedded corpus at `src/assets/hints/cli-hints-{full,short}.md`
|
|
19
|
+
|
|
20
|
+
## Use
|
|
21
|
+
|
|
22
|
+
One library for every agent: connect what you already have, load only what
|
|
23
|
+
the task needs, and capture what you learn along the way.
|
|
24
|
+
|
|
25
|
+
- [Use AKM With Any Agent](https://github.com/itlackey/akm/blob/main/docs/guides/use-with-any-agent.md) -- Wire akm into Claude Code, OpenCode, Cursor, and other coding assistants with a three-line system prompt block
|
|
26
|
+
- [Discover and Load](https://github.com/itlackey/akm/blob/main/docs/guides/discover-and-load.md) -- Search, curate a shortlist, and load exactly the ref a task needs
|
|
27
|
+
- [Bundles](https://github.com/itlackey/akm/blob/main/docs/guides/bundles.md) -- Connect local dirs, git repos, npm packages, and websites; browse the registry
|
|
28
|
+
- [Capture Knowledge](https://github.com/itlackey/akm/blob/main/docs/guides/capture-knowledge.md) -- `akm remember`, `akm import`, and how captured material becomes available to every agent
|
|
12
29
|
- [Wikis](https://github.com/itlackey/akm/blob/main/docs/guides/wikis.md) -- Multi-wiki knowledge bases (Karpathy-style)
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
15
|
-
-
|
|
30
|
+
- [Environment & Secrets](https://github.com/itlackey/akm/blob/main/docs/reference/env-and-secrets.md) -- `akm env` and `akm secret`: exact operations, file modes, and the security guarantee
|
|
31
|
+
- [Run Workflows](https://github.com/itlackey/akm/blob/main/docs/guides/run-workflows.md) -- Start or continue a run, check on it, resume it, or abandon it
|
|
32
|
+
- [Scheduling](https://github.com/itlackey/akm/blob/main/docs/guides/scheduling.md) -- Run akm tasks through the OS scheduler (cron / launchd / schtasks) safely
|
|
33
|
+
- [Improve the Library](https://github.com/itlackey/akm/blob/main/docs/guides/improve-the-library.md) -- Feedback, history, and proposals -- how evidence turns into reviewable changes
|
|
34
|
+
- Recipes: [Turn a Website into a Searchable Bundle](https://github.com/itlackey/akm/blob/main/docs/guides/recipes/website-source.md), [Headless Install](https://github.com/itlackey/akm/blob/main/docs/guides/recipes/headless-install.md)
|
|
16
35
|
|
|
17
|
-
##
|
|
36
|
+
## Build and operate
|
|
18
37
|
|
|
19
|
-
|
|
20
|
-
- [Configuration](reference/configuration.md) -- Engines, strategies, bundles, and settings
|
|
21
|
-
- [Workflows](reference/workflows.md) -- Unified Markdown workflow schema, run state, and native orchestration engine
|
|
22
|
-
- [Wiki Snapshot Fetchers](https://github.com/itlackey/akm/blob/main/docs/reference/wiki-snapshot-fetchers.md) -- The pluggable fetcher API for URL-based knowledge reads
|
|
23
|
-
- [Registry](https://github.com/itlackey/akm/blob/main/docs/reference/registry.md) -- Registries, search, hosting, and managing sources
|
|
24
|
-
- [Data & Telemetry](reference/data-and-telemetry.md) -- Exactly what akm reads and writes on your machine (no remote telemetry)
|
|
25
|
-
- [akm-eval](https://github.com/itlackey/akm/blob/main/docs/reference/akm-eval.md) -- Standalone toolkit for measuring whether `akm improve` is working
|
|
26
|
-
- [Roadmap](https://github.com/itlackey/akm/blob/main/docs/reference/roadmap.md) -- High-level focus for the 0.9 and 1.0 releases
|
|
38
|
+
Package complete capabilities and turn knowledge into repeatable work.
|
|
27
39
|
|
|
28
|
-
|
|
40
|
+
- [Bundle Author's Guide](https://github.com/itlackey/akm/blob/main/docs/guides/author-bundles.md) -- Build a bundle, make it discoverable, and share it so others can install it with `akm bundle add`
|
|
41
|
+
- [Author's Guide: Writing Workflows](https://github.com/itlackey/akm/blob/main/docs/guides/author-workflows.md) -- Write and test a workflow definition, from a minimal example to gates and outputs
|
|
42
|
+
- [Claude Code workflows vs. akm workflows](https://github.com/itlackey/akm/blob/main/docs/guides/claude-code-vs-akm-workflows.md) -- Short decision guide for choosing between a session-native workflow and an akm workflow ([full technical comparison](https://github.com/itlackey/akm/blob/main/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md))
|
|
29
43
|
|
|
30
|
-
|
|
31
|
-
- [Agent Install Guide](https://github.com/itlackey/akm/blob/main/docs/agents/agent-install.md) -- Step-by-step automated install for agents
|
|
32
|
-
- [Curate Workmap](https://github.com/itlackey/akm/blob/main/docs/agents/curate-workmap.md) -- Read before changing `akm curate` ranking or output
|
|
44
|
+
### Maintainers
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
Working on akm itself, not just using it.
|
|
35
47
|
|
|
36
|
-
|
|
48
|
+
- [Maintainer Docs](https://github.com/itlackey/akm/blob/main/docs/maintainers/README.md) -- Start here: local development, measuring improvement, and the curate contract
|
|
49
|
+
- [Local Development](https://github.com/itlackey/akm/blob/main/docs/maintainers/local-development.md) -- Dogfooding akm while editing its own source
|
|
50
|
+
- [akm-eval](https://github.com/itlackey/akm/blob/main/docs/maintainers/eval.md) -- Standalone toolkit for measuring whether `akm improve` is working
|
|
51
|
+
- [Curate Workmap](https://github.com/itlackey/akm/blob/main/docs/maintainers/curate-workmap.md) -- The current `akm curate` contract and the highest-value next fixes
|
|
37
52
|
|
|
53
|
+
## Look up details
|
|
54
|
+
|
|
55
|
+
- [CLI](reference/cli.md) -- All `akm` commands and flags
|
|
56
|
+
- [Configuration](reference/configuration.md) -- Engines, strategies, bundles, and settings
|
|
57
|
+
- [Supported Formats](reference/supported-formats.md) -- Every bundle format akm recognizes, its detection marker, and current read/write support
|
|
58
|
+
- [Asset Types](https://github.com/itlackey/akm/blob/main/docs/reference/asset-types.md) -- The capability taxonomy, directory conventions, and per-type examples
|
|
59
|
+
- [Refs](https://github.com/itlackey/akm/blob/main/docs/reference/refs.md) -- The ref grammar `akm search` emits and `akm show` consumes
|
|
60
|
+
- [Memory](https://github.com/itlackey/akm/blob/main/docs/reference/memory.md) -- The `memory` asset type: capture, belief states, and derived memories
|
|
61
|
+
- [Workflow Schema](reference/workflow-schema.md) -- Authoritative frontmatter/body syntax for a workflow asset
|
|
62
|
+
- [Workflows (overview)](reference/workflows.md) -- Short map across the workflow schema, engine, and how-to guides
|
|
63
|
+
- [Registry](https://github.com/itlackey/akm/blob/main/docs/reference/registry.md) -- Registries, search, hosting, and managing sources
|
|
64
|
+
- [Website Sources](https://github.com/itlackey/akm/blob/main/docs/reference/website-sources.md) -- The pluggable fetcher API for URL-based knowledge reads
|
|
65
|
+
- [Data & Telemetry](reference/data-and-telemetry.md) -- Exactly what akm reads and writes on your machine (no remote telemetry)
|
|
38
66
|
- [Architecture](https://github.com/itlackey/akm/blob/main/docs/architecture/architecture.md) -- How akm's bundles, cache, index, and registries fit together
|
|
39
67
|
- [Core Principles](https://github.com/itlackey/akm/blob/main/docs/architecture/akm-core-principles.md) -- Design principles and constraints
|
|
40
|
-
- [
|
|
68
|
+
- [Adapters](https://github.com/itlackey/akm/blob/main/docs/architecture/adapters.md) -- How akm picks an adapter, indexes, validates, and writes into a bundle
|
|
69
|
+
- [The Workflow Engine](https://github.com/itlackey/akm/blob/main/docs/architecture/workflow-engine.md) -- How a frozen plan is stored, dispatched, and resumed without replaying completed units
|
|
70
|
+
- [The Improvement Loop](https://github.com/itlackey/akm/blob/main/docs/architecture/improvement.md) -- How a feedback signal becomes a ranking change, and how evidence becomes a proposal
|
|
71
|
+
- [Runtime Boundary Design](https://github.com/itlackey/akm/blob/main/docs/architecture/runtime-boundary-design.md) -- Isolating `bun:sqlite`/`Bun.*` from the core
|
|
72
|
+
- [Architecture Decision History](https://github.com/itlackey/akm/blob/main/docs/architecture/akm-architecture-decision-history.md) -- ADR-style record of the major architecture rulings
|
|
73
|
+
- [Specs](https://github.com/itlackey/akm/blob/main/docs/architecture/README.md#specs-specs) -- Normative specifications (bundle/adapter model, ref grammar, bundle conventions)
|
|
41
74
|
- [Internals](https://github.com/itlackey/akm/blob/main/docs/architecture/README.md#internals-internals) -- Current-truth subsystem references (storage, search, indexing, improve, health)
|
|
42
75
|
- [Testing](https://github.com/itlackey/akm/blob/main/docs/architecture/README.md#testing-testing) -- Testing workflow and pre-release checklist
|
|
76
|
+
- [Migration](migration/README.md) -- Upgrade guides and per-release migration notes
|
|
77
|
+
- [Roadmap](https://github.com/itlackey/akm/blob/main/ROADMAP.md) -- High-level focus for the releases from here through 1.0
|
|
43
78
|
|
|
44
|
-
##
|
|
79
|
+
## Execution boundary
|
|
45
80
|
|
|
46
|
-
|
|
47
|
-
|
|
81
|
+
AKM retrieves every supported capability type. It directly orchestrates
|
|
82
|
+
defined execution surfaces such as workflows, agent dispatch, tasks, and
|
|
83
|
+
guarded subprocess injection. It does not blindly execute arbitrary indexed
|
|
84
|
+
content merely because that content appears in search results. See
|
|
85
|
+
[Core Principles](https://github.com/itlackey/akm/blob/main/docs/architecture/akm-core-principles.md) for the full boundary,
|
|
86
|
+
and [The Improvement Loop](https://github.com/itlackey/akm/blob/main/docs/architecture/improvement.md) for how that boundary
|
|
87
|
+
applies to akm's own self-generated changes.
|
|
48
88
|
|
|
49
|
-
##
|
|
89
|
+
## Posts
|
|
50
90
|
|
|
51
|
-
Source articles for the dev.to publishing pipeline (historical record).
|
|
91
|
+
Source articles for the dev.to publishing pipeline (historical record). See
|
|
92
|
+
[docs/posts/README.md](https://github.com/itlackey/akm/blob/main/docs/posts/README.md).
|
|
52
93
|
|
|
53
94
|
## Official Ecosystem Repositories
|
|
54
95
|
|
|
55
|
-
- [itlackey/akm-stash](https://github.com/itlackey/akm-stash) -- the official onboarding
|
|
96
|
+
- [itlackey/akm-stash](https://github.com/itlackey/akm-stash) -- the official onboarding bundle with ready-made assets you can install with `akm bundle add`
|
|
56
97
|
- [itlackey/akm-registry](https://github.com/itlackey/akm-registry) -- the official registry index that powers built-in discovery
|
|
57
98
|
- [itlackey/akm-plugins](https://github.com/itlackey/akm-plugins) -- optional integrations for tools like OpenCode
|
|
58
|
-
- [itlackey/akm-bench](https://github.com/itlackey/akm-bench) -- the standalone benchmark
|
|
99
|
+
- [itlackey/akm-bench](https://github.com/itlackey/akm-bench) -- the standalone benchmark harness for measuring agent performance with akm
|
|
100
|
+
- [itlackey/akm-eval](https://github.com/itlackey/akm-eval) -- the eval framework and tools for akm asset quality (distinct from the in-repo [`scripts/akm-eval/` toolkit](https://github.com/itlackey/akm/blob/main/docs/maintainers/eval.md))
|
|
59
101
|
|
|
60
102
|
---
|
|
61
103
|
|
|
@@ -36,7 +36,8 @@ Key operator-facing changes:
|
|
|
36
36
|
**What this refactor does not (yet) touch: placement.**
|
|
37
37
|
`adapter.placeNew()` is defined on the interface
|
|
38
38
|
(`src/core/adapter/bundle-adapter.ts`) as an optional capability method and
|
|
39
|
-
already implemented by
|
|
39
|
+
already implemented by 9 of the 11 built-in adapters (all but `okf` and
|
|
40
|
+
`website-snapshot`), but nothing in the write
|
|
40
41
|
path calls it in 0.9.0 — writes still route through AKM's native flat
|
|
41
42
|
type→directory placement table (`stashDirFor` in
|
|
42
43
|
`src/core/asset/asset-placement.ts`). That wiring is deferred to 0.10 as
|
|
@@ -34,7 +34,8 @@ below explains what the script does and what you need to verify afterward.
|
|
|
34
34
|
- [Verifying the upgrade](#verifying-the-upgrade)
|
|
35
35
|
- [Troubleshooting](#troubleshooting)
|
|
36
36
|
- [Rolling back](#rolling-back)
|
|
37
|
-
- [Config
|
|
37
|
+
- [Config 0.8.0 migration (unified profiles)](#config-080-migration-unified-profiles)
|
|
38
|
+
- [Config layer rewrite (late-0.8.x)](#config-layer-rewrite-late-08x)
|
|
38
39
|
- [End-of-run auto-sync for git-backed stashes](#end-of-run-auto-sync-for-git-backed-stashes)
|
|
39
40
|
|
|
40
41
|
## Installing 0.8.0
|
|
@@ -749,7 +749,9 @@ change type and ref spelling to the owning adapter's own scheme the first time
|
|
|
749
749
|
you reindex after upgrading. **No action needed** — the index is a
|
|
750
750
|
regenerable cache and rebuilds itself — but searches or saved refs into those
|
|
751
751
|
bundles may resolve to the new spellings afterwards. Reindex with `akm index`
|
|
752
|
-
right after the cutover so this settles before you rely on saved refs.
|
|
752
|
+
right after the cutover so this settles before you rely on saved refs. See
|
|
753
|
+
[Bundle Types](../reference/bundle-types.md) for the full 11-adapter list,
|
|
754
|
+
detection rules, and what each one reads/writes.
|
|
753
755
|
|
|
754
756
|
### 0.8 workflow assets after migration
|
|
755
757
|
|
package/docs/reference/README.md
CHANGED
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Authoritative reference documentation for the akm CLI and its data.
|
|
4
4
|
|
|
5
|
+
- [Bundle Types](bundle-types.md) -- Pointer page: where the bundle-format compatibility table and adapter internals now live
|
|
5
6
|
- [CLI](cli.md) -- All `akm` commands and flags
|
|
6
7
|
- [Configuration](configuration.md) -- Engines, strategies, bundles, and settings
|
|
7
|
-
- [
|
|
8
|
+
- [Supported Formats](supported-formats.md) -- Formats akm can index, from its own bundle layout to other tools' existing asset directories
|
|
9
|
+
- [Workflow Schema](workflow-schema.md) -- Authoritative reference for a workflow asset's exact frontmatter and body syntax
|
|
10
|
+
- [Workflows](workflows.md) -- Map of the workflow documentation: running, authoring, the schema, and the engine
|
|
11
|
+
- [Memory](https://github.com/itlackey/akm/blob/main/docs/reference/memory.md) -- The `memory` asset type: capture, belief states, and derived memories
|
|
12
|
+
- [Refs](https://github.com/itlackey/akm/blob/main/docs/reference/refs.md) -- The ref grammar `akm search` emits and `akm show` consumes, rename semantics, and namespacing
|
|
13
|
+
- [Asset Types](https://github.com/itlackey/akm/blob/main/docs/reference/asset-types.md) -- The capability taxonomy the native `akm` adapter recognizes, bundle layout, and asset metadata
|
|
14
|
+
- [Environment & Secrets](https://github.com/itlackey/akm/blob/main/docs/reference/env-and-secrets.md) -- `akm env` and `akm secret`, the two protected-value asset types
|
|
8
15
|
- [Registry](https://github.com/itlackey/akm/blob/main/docs/reference/registry.md) -- Registries, search, hosting, and managing sources
|
|
9
|
-
- [
|
|
16
|
+
- [Website Sources](https://github.com/itlackey/akm/blob/main/docs/reference/website-sources.md) -- The pluggable fetcher API behind `akm import <url>` and other URL-based knowledge reads
|
|
10
17
|
- [Data & Telemetry](data-and-telemetry.md) -- Exactly what akm reads and writes on your machine (no remote telemetry)
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
|
|
19
|
+
See also: [akm-eval](https://github.com/itlackey/akm/blob/main/docs/maintainers/eval.md) -- the standalone toolkit for measuring whether `akm improve` is working (maintainer docs), and the repo-root [Roadmap](https://github.com/itlackey/akm/blob/main/ROADMAP.md) -- high-level focus for upcoming releases.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Bundle Types
|
|
2
|
+
|
|
3
|
+
This page has moved. AKM's bundle-format documentation is now split in two:
|
|
4
|
+
the public compatibility table lives at
|
|
5
|
+
[Supported Formats](supported-formats.md), and the adapter internals — probe
|
|
6
|
+
order, the `BundleAdapter` interface, `placeNew()` wiring status, and the
|
|
7
|
+
write allowlists — live at
|
|
8
|
+
[Architecture → Adapters](https://github.com/itlackey/akm/blob/main/docs/architecture/adapters.md).
|
|
9
|
+
|
|
10
|
+
- [Supported Formats](supported-formats.md) — the format-by-format table:
|
|
11
|
+
what AKM indexes, the auto-detection marker, current read/write support,
|
|
12
|
+
and typical use, for all 11 built-in formats (`akm` native, `okf`,
|
|
13
|
+
`llm-wiki`, `claude`, `opencode`, `agent-skills`, `dotenv`,
|
|
14
|
+
`akm-workflow`, `akm-task`, `website-snapshot`, `generic-files`).
|
|
15
|
+
- [Architecture → Adapters](https://github.com/itlackey/akm/blob/main/docs/architecture/adapters.md) — how AKM picks an
|
|
16
|
+
adapter for a bundle, the `BundleAdapter` interface contract, the current
|
|
17
|
+
`placeNew()` wiring status, the write allowlists that actually gate
|
|
18
|
+
`akm remember`/`import`/`proposal accept`/etc., and per-adapter
|
|
19
|
+
implementation caveats.
|