kc-beta 0.7.3 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +57 -4
  2. package/bin/kc-beta.js +20 -6
  3. package/package.json +3 -2
  4. package/src/agent/engine.js +493 -132
  5. package/src/agent/pipelines/_advance-hints.js +92 -0
  6. package/src/agent/pipelines/_milestone-derive.js +387 -17
  7. package/src/agent/pipelines/initializer.js +4 -1
  8. package/src/agent/pipelines/skill-authoring.js +30 -1
  9. package/src/agent/skill-loader.js +433 -111
  10. package/src/agent/tools/agent-tool.js +2 -2
  11. package/src/agent/tools/consult-skill.js +127 -0
  12. package/src/agent/tools/copy-to-workspace.js +4 -3
  13. package/src/agent/tools/dashboard-render.js +48 -1
  14. package/src/agent/tools/document-parse.js +31 -2
  15. package/src/agent/tools/phase-advance.js +17 -13
  16. package/src/agent/tools/release.js +378 -8
  17. package/src/agent/tools/sandbox-exec.js +65 -8
  18. package/src/agent/tools/worker-llm-call.js +95 -15
  19. package/src/agent/tools/workspace-file.js +7 -7
  20. package/src/agent/workspace.js +25 -4
  21. package/src/cli/components.js +4 -1
  22. package/src/cli/index.js +97 -1
  23. package/src/config.js +20 -3
  24. package/src/marathon/driver.js +217 -0
  25. package/src/marathon/prompts.js +93 -0
  26. package/template/.env.template +16 -0
  27. package/template/AGENT.md +182 -7
  28. package/template/skills/en/{meta-meta/auto-model-selection → auto-model-selection}/SKILL.md +1 -0
  29. package/template/skills/en/{meta-meta/bootstrap-workspace → bootstrap-workspace}/SKILL.md +15 -0
  30. package/template/skills/{zh/meta → en}/compliance-judgment/SKILL.md +1 -0
  31. package/template/skills/en/{meta/confidence-system → confidence-system}/SKILL.md +1 -0
  32. package/template/skills/en/{meta/corner-case-management → corner-case-management}/SKILL.md +1 -0
  33. package/template/skills/en/{meta/cross-document-verification → cross-document-verification}/SKILL.md +1 -0
  34. package/template/skills/en/{meta-meta/dashboard-reporting → dashboard-reporting}/SKILL.md +1 -0
  35. package/template/skills/en/{meta/data-sensibility → data-sensibility}/SKILL.md +1 -0
  36. package/template/skills/{zh/meta → en}/document-chunking/SKILL.md +1 -0
  37. package/template/skills/en/{meta/document-parsing → document-parsing}/SKILL.md +1 -0
  38. package/template/skills/{zh/meta → en}/entity-extraction/SKILL.md +1 -0
  39. package/template/skills/en/{meta-meta/evolution-loop → evolution-loop}/SKILL.md +1 -0
  40. package/template/skills/en/{meta-meta/pdf-review-dashboard → pdf-review-dashboard}/SKILL.md +1 -0
  41. package/template/skills/en/{meta-meta/quality-control → quality-control}/SKILL.md +10 -0
  42. package/template/skills/en/{meta-meta/rule-extraction → rule-extraction}/SKILL.md +1 -0
  43. package/template/skills/en/{meta-meta/rule-graph → rule-graph}/SKILL.md +1 -0
  44. package/template/skills/en/{meta-meta/skill-authoring → skill-authoring}/SKILL.md +40 -0
  45. package/template/skills/en/skill-creator/SKILL.md +2 -1
  46. package/template/skills/en/{meta-meta/skill-to-workflow → skill-to-workflow}/SKILL.md +58 -4
  47. package/template/skills/en/{meta-meta/task-decomposition → task-decomposition}/SKILL.md +1 -0
  48. package/template/skills/en/{meta/tree-processing → tree-processing}/SKILL.md +1 -0
  49. package/template/skills/en/{meta-meta/version-control → version-control}/SKILL.md +1 -0
  50. package/template/skills/en/{meta-meta/work-decomposition → work-decomposition}/SKILL.md +51 -6
  51. package/template/skills/phase_skills.yaml +112 -0
  52. package/template/skills/zh/{meta-meta/auto-model-selection → auto-model-selection}/SKILL.md +1 -0
  53. package/template/skills/zh/{meta-meta/bootstrap-workspace → bootstrap-workspace}/SKILL.md +15 -0
  54. package/template/skills/zh/compliance-judgment/SKILL.md +83 -0
  55. package/template/skills/zh/{meta/confidence-system → confidence-system}/SKILL.md +1 -0
  56. package/template/skills/zh/{meta/corner-case-management → corner-case-management}/SKILL.md +1 -0
  57. package/template/skills/zh/{meta/cross-document-verification → cross-document-verification}/SKILL.md +1 -0
  58. package/template/skills/zh/{meta-meta/dashboard-reporting → dashboard-reporting}/SKILL.md +1 -0
  59. package/template/skills/zh/{meta/data-sensibility → data-sensibility}/SKILL.md +1 -0
  60. package/template/skills/zh/document-chunking/SKILL.md +40 -0
  61. package/template/skills/zh/document-parsing/SKILL.md +102 -0
  62. package/template/skills/zh/entity-extraction/SKILL.md +121 -0
  63. package/template/skills/zh/{meta-meta/evolution-loop → evolution-loop}/SKILL.md +1 -0
  64. package/template/skills/zh/{meta-meta/pdf-review-dashboard → pdf-review-dashboard}/SKILL.md +1 -0
  65. package/template/skills/zh/{meta-meta/quality-control → quality-control}/SKILL.md +10 -0
  66. package/template/skills/zh/{meta-meta/rule-extraction → rule-extraction}/SKILL.md +1 -0
  67. package/template/skills/zh/{meta-meta/rule-graph → rule-graph}/SKILL.md +1 -0
  68. package/template/skills/zh/{meta-meta/skill-authoring → skill-authoring}/SKILL.md +40 -0
  69. package/template/skills/zh/skill-creator/SKILL.md +205 -200
  70. package/template/skills/zh/skill-to-workflow/SKILL.md +243 -0
  71. package/template/skills/zh/{meta-meta/task-decomposition → task-decomposition}/SKILL.md +1 -0
  72. package/template/skills/zh/tree-processing/SKILL.md +126 -0
  73. package/template/skills/zh/{meta-meta/version-control → version-control}/SKILL.md +1 -0
  74. package/template/skills/zh/{meta-meta/work-decomposition → work-decomposition}/SKILL.md +49 -4
  75. package/template/workflows/common/llm_client.py +168 -0
  76. package/template/workflows/common/utils.py +132 -0
  77. package/template/CLAUDE.md +0 -150
  78. package/template/skills/en/meta/compliance-judgment/SKILL.md +0 -82
  79. package/template/skills/en/meta/document-chunking/SKILL.md +0 -32
  80. package/template/skills/en/meta/entity-extraction/SKILL.md +0 -120
  81. package/template/skills/zh/meta/document-parsing/SKILL.md +0 -101
  82. package/template/skills/zh/meta/tree-processing/SKILL.md +0 -121
  83. package/template/skills/zh/meta-meta/skill-to-workflow/SKILL.md +0 -188
  84. /package/template/skills/en/{meta/compliance-judgment → compliance-judgment}/references/output-format.md +0 -0
  85. /package/template/skills/en/{meta/cross-document-verification → cross-document-verification}/references/contradiction-taxonomy.md +0 -0
  86. /package/template/skills/en/{meta-meta/dashboard-reporting → dashboard-reporting}/scripts/generate_dashboard.py +0 -0
  87. /package/template/skills/en/{meta/document-parsing → document-parsing}/references/parser-catalog.md +0 -0
  88. /package/template/skills/en/{meta-meta/evolution-loop → evolution-loop}/references/convergence-guide.md +0 -0
  89. /package/template/skills/en/{meta-meta/pdf-review-dashboard → pdf-review-dashboard}/scripts/generate_review.js +0 -0
  90. /package/template/skills/en/{meta-meta/quality-control → quality-control}/references/qa-layers.md +0 -0
  91. /package/template/skills/en/{meta-meta/quality-control → quality-control}/references/sampling-strategies.md +0 -0
  92. /package/template/skills/en/{meta-meta/rule-extraction → rule-extraction}/references/chunking-strategies.md +0 -0
  93. /package/template/skills/en/{meta-meta/skill-authoring → skill-authoring}/references/skill-format-spec.md +0 -0
  94. /package/template/skills/en/{meta-meta/skill-to-workflow → skill-to-workflow}/references/worker-llm-catalog.md +0 -0
  95. /package/template/skills/en/{meta-meta/task-decomposition → task-decomposition}/references/decision-matrix.md +0 -0
  96. /package/template/skills/en/{meta-meta/version-control → version-control}/references/trace-id-spec.md +0 -0
  97. /package/template/skills/zh/{meta/compliance-judgment → compliance-judgment}/references/output-format.md +0 -0
  98. /package/template/skills/zh/{meta/cross-document-verification → cross-document-verification}/references/contradiction-taxonomy.md +0 -0
  99. /package/template/skills/zh/{meta-meta/dashboard-reporting → dashboard-reporting}/scripts/generate_dashboard.py +0 -0
  100. /package/template/skills/zh/{meta/document-parsing → document-parsing}/references/parser-catalog.md +0 -0
  101. /package/template/skills/zh/{meta-meta/evolution-loop → evolution-loop}/references/convergence-guide.md +0 -0
  102. /package/template/skills/zh/{meta-meta/pdf-review-dashboard → pdf-review-dashboard}/scripts/generate_review.js +0 -0
  103. /package/template/skills/zh/{meta-meta/quality-control → quality-control}/references/qa-layers.md +0 -0
  104. /package/template/skills/zh/{meta-meta/quality-control → quality-control}/references/sampling-strategies.md +0 -0
  105. /package/template/skills/zh/{meta-meta/rule-extraction → rule-extraction}/references/chunking-strategies.md +0 -0
  106. /package/template/skills/zh/{meta-meta/skill-authoring → skill-authoring}/references/skill-format-spec.md +0 -0
  107. /package/template/skills/zh/{meta-meta/skill-to-workflow → skill-to-workflow}/references/worker-llm-catalog.md +0 -0
  108. /package/template/skills/zh/{meta-meta/task-decomposition → task-decomposition}/references/decision-matrix.md +0 -0
  109. /package/template/skills/zh/{meta-meta/version-control → version-control}/references/trace-id-spec.md +0 -0
package/README.md CHANGED
@@ -21,12 +21,59 @@ npm install -g kc-beta
21
21
  kc-beta onboard # configure provider + API key
22
22
  cd my-project # a folder containing rules/ and samples/
23
23
  kc-beta # launch the agent
24
+
25
+ # v0.8.1+ unattended runs: type the slash command inside the kc-beta TUI
26
+ > /marathon Verify the new regulation against samples/. Iterate twice. If
27
+ most workflows work with regex, build another version using tier1+tier2
28
+ worker LLMs more aggressively.
29
+ # Marathon mode chains turns automatically. /marathon off disengages.
30
+ # /marathon status shows the driver state.
24
31
  ```
25
32
 
26
33
  Requires **Node.js 20+**. See [QUICKSTART.md](./QUICKSTART.md) for the full setup walkthrough.
27
34
 
28
35
  ---
29
36
 
37
+ ## v0.8 Highlights
38
+
39
+ - **`/marathon <goal>` slash command** (v0.8.1; replaces the v0.8.0
40
+ separate-process `kc-marathon` CLI). Activates an inline driver inside
41
+ the running kc-beta TUI. Goal embedded in the command. `/marathon off`
42
+ to disengage manually; `/marathon status` to inspect. F5
43
+ one-phase-per-prompt stays enabled for interactive sessions and
44
+ bypasses cleanly when marathon is active. Status-bar shows
45
+ `🏃 MARATHON` only when active — no clutter in normal mode. v0.8.0's
46
+ separate-process driver was scrapped after E2E #11 found drivers
47
+ died silently when their parent terminal closed (SIGHUP unhandled).
48
+ - **Skill usage counter** — passive Layer-B measurement of which skills
49
+ the engine actually ships to the LLM. `skill_byte_send` events go to
50
+ events.jsonl; the audit script aggregates per-phase × per-skill.
51
+ Agent-blind by design.
52
+ - **`worker_llm_call` batch mode** — `prompts: [...]` array input with
53
+ concurrency control (default 5, max 10). Pairs with a canonical
54
+ `workflows/common/llm_client.py` shim (taught in `skill-to-workflow`)
55
+ so distilled workflows route through the engine where possible and
56
+ log to `output/llm_ledger.jsonl` when they don't.
57
+ - **`sandbox_exec` timeout model** — default 120s (was 30s); per-call
58
+ `timeout_ms` up to 600s for known-slow commands. Configurable via
59
+ `KC_EXEC_DEFAULT_TIMEOUT_MS` + `KC_EXEC_MAX_TIMEOUT_MS`.
60
+ - **Prescriptive phase-advance hints** — refusal messages now name
61
+ concrete next-action artifacts (`workflows/<rule_id>/workflow_v1.py`,
62
+ `output/results/production_qc_results.json`, etc.) instead of
63
+ descriptive `engineCounts` only.
64
+ - **`check.py` substantiveness audit** — engine detects stub-shaped
65
+ rule_skills/<id>/check.py files (NOT_APPLICABLE-only returns with no
66
+ workflow delegation). Surfaced in milestones; opt-in enforcement via
67
+ `KC_ENFORCE_CHECK_PY_SUBSTANTIVE=1`.
68
+
69
+ Plus engine-fix carryover from the v0.7.5 audit cycle: H3 calibration
70
+ aggregator schema, milestone-derivation gaps (review_001.json + multi-
71
+ path coverage_report.md), VLM runtime hardcode (workspace .env overlay),
72
+ heap_mb periodic-write fix, stale release detection, taskboard skill
73
+ availability in every phase. Full list: see DEV_LOG v0.8 entry.
74
+
75
+ ---
76
+
30
77
  ## What It Does
31
78
 
32
79
  KC drives a single coding agent through seven phases:
@@ -216,8 +263,8 @@ Quality Thresholds, Language.
216
263
 
217
264
  ## Status
218
265
 
219
- **v0.7.3 — codex review patch release.** Latest line in the v0.7.x
220
- hardening track. Architectural payload from v0.6.0+ is still in place:
266
+ **v0.7.4phase-control fix + codex review re-attempt.** Architectural
267
+ payload from v0.6.0+ is still in place:
221
268
 
222
269
  - Parallel ralph-loop (up to 8 concurrent workers) with a heap-safety
223
270
  conformance gate
@@ -226,8 +273,14 @@ hardening track. Architectural payload from v0.6.0+ is still in place:
226
273
  - Agent-owned task board: the agent reads the rule list from
227
274
  `describeState`, decides decomposition (per-rule / grouped / range),
228
275
  and calls `TaskCreate` / `TaskUpdate` / `TaskComplete` to drive the
229
- Ralph loop. Source-context auto-attach pulls rule NL + evidence chunks
230
- + sibling rules into the prompt of each task as it runs.
276
+ Ralph loop **within the current phase only** (v0.7.4). Source-context
277
+ auto-attach pulls rule NL + evidence chunks + sibling rules into each
278
+ task's prompt.
279
+ - Phase boundaries = user checkpoints: the Ralph loop exits at every
280
+ phase transition, returning control to the user. The engine doesn't
281
+ auto-advance; phase advance is explicit (agent's `phase_advance` tool
282
+ call or user re-prompt). Marathon-style end-to-end autonomy lives
283
+ outside the engine.
231
284
  - Workspace file locking for shared coordination files (`rules/catalog.json`,
232
285
  `rules/manifest.json`, `refs/manifest.json`, `tasks.json`,
233
286
  `session-state.json`) — every writer goes through `withFileLock`.
package/bin/kc-beta.js CHANGED
@@ -34,17 +34,31 @@ if (parallelismOverride !== null) {
34
34
  // their own output.
35
35
  const __filename = fileURLToPath(import.meta.url);
36
36
  const __dirname = dirname(__filename);
37
- function printBanner() {
37
+ function readPkgVersion() {
38
38
  try {
39
39
  const pkg = JSON.parse(readFileSync(resolve(__dirname, "..", "package.json"), "utf-8"));
40
- const scriptPath = __filename;
41
- process.stderr.write(`⏵⏵ KC Agent CLI v${pkg.version} · ${scriptPath}\n`);
42
- } catch { /* package.json missing or unreadable — silent */ }
40
+ return pkg.version || "unknown";
41
+ } catch { return "unknown"; }
42
+ }
43
+ function printBanner() {
44
+ try {
45
+ const v = readPkgVersion();
46
+ process.stderr.write(`⏵⏵ KC Agent CLI v${v} · ${__filename}\n`);
47
+ } catch { /* silent */ }
43
48
  }
44
- const suppressBanner = args.includes("--version") || args.includes("-v") ||
45
- args.includes("--help") || args.includes("-h");
49
+ const isVersion = args.includes("--version") || args.includes("-v");
50
+ const isHelp = args.includes("--help") || args.includes("-h");
51
+ const suppressBanner = isVersion || isHelp;
46
52
  if (!suppressBanner) printBanner();
47
53
 
54
+ // v0.7.5 G-F1: `--version` prints version and exits. Previously the flag
55
+ // suppressed the banner but fell through to TUI launch (audit confirmed
56
+ // during v0.7.4 testing). Print + exit before the subcommand dispatch.
57
+ if (isVersion) {
58
+ process.stdout.write(`${readPkgVersion()}\n`);
59
+ process.exit(0);
60
+ }
61
+
48
62
  (async () => {
49
63
  if (subcommand === "onboard" || subcommand === "setup") {
50
64
  const { onboard } = await import("../src/cli/onboard.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kc-beta",
3
- "version": "0.7.3",
3
+ "version": "0.8.1",
4
4
  "description": "KC Agent — LLM document verification agent (pure Node.js CLI). Dual-licensed: PolyForm Noncommercial 1.0.0 for personal/noncommercial use; commercial license required for enterprise production. See LICENSE and LICENSE-COMMERCIAL.md.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,8 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "build:meme": "node scripts/build-meme.js",
21
- "prepublishOnly": "node scripts/build-meme.js"
21
+ "prepublishOnly": "node scripts/build-meme.js",
22
+ "test": "node scripts/run-tests.js"
22
23
  },
23
24
  "homepage": "https://github.com/kitchen-engineer42/kc-cli",
24
25
  "repository": {