kc-beta 0.7.3 → 0.7.5
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/README.md +10 -4
- package/bin/kc-beta.js +20 -6
- package/package.json +1 -1
- package/src/agent/engine.js +131 -60
- package/src/agent/pipelines/_milestone-derive.js +140 -4
- package/src/agent/pipelines/initializer.js +4 -1
- package/src/agent/skill-loader.js +433 -111
- package/src/agent/tools/consult-skill.js +112 -0
- package/src/agent/tools/copy-to-workspace.js +4 -3
- package/src/agent/tools/release.js +128 -1
- package/src/agent/tools/workspace-file.js +7 -7
- package/src/config.js +1 -1
- package/template/AGENT.md +182 -7
- package/template/skills/en/{meta-meta/auto-model-selection → auto-model-selection}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/bootstrap-workspace → bootstrap-workspace}/SKILL.md +1 -0
- package/template/skills/{zh/meta → en}/compliance-judgment/SKILL.md +1 -0
- package/template/skills/en/{meta/confidence-system → confidence-system}/SKILL.md +1 -0
- package/template/skills/en/{meta/corner-case-management → corner-case-management}/SKILL.md +1 -0
- package/template/skills/en/{meta/cross-document-verification → cross-document-verification}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/dashboard-reporting → dashboard-reporting}/SKILL.md +1 -0
- package/template/skills/en/{meta/data-sensibility → data-sensibility}/SKILL.md +1 -0
- package/template/skills/{zh/meta → en}/document-chunking/SKILL.md +1 -0
- package/template/skills/en/{meta/document-parsing → document-parsing}/SKILL.md +1 -0
- package/template/skills/{zh/meta → en}/entity-extraction/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/evolution-loop → evolution-loop}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/pdf-review-dashboard → pdf-review-dashboard}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/quality-control → quality-control}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/rule-extraction → rule-extraction}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/rule-graph → rule-graph}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/skill-authoring → skill-authoring}/SKILL.md +1 -0
- package/template/skills/en/skill-creator/SKILL.md +2 -1
- package/template/skills/en/{meta-meta/skill-to-workflow → skill-to-workflow}/SKILL.md +5 -4
- package/template/skills/en/{meta-meta/task-decomposition → task-decomposition}/SKILL.md +1 -0
- package/template/skills/en/{meta/tree-processing → tree-processing}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/version-control → version-control}/SKILL.md +1 -0
- package/template/skills/en/{meta-meta/work-decomposition → work-decomposition}/SKILL.md +17 -6
- package/template/skills/phase_skills.yaml +107 -0
- package/template/skills/zh/{meta-meta/auto-model-selection → auto-model-selection}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/bootstrap-workspace → bootstrap-workspace}/SKILL.md +1 -0
- package/template/skills/{en/meta → zh}/compliance-judgment/SKILL.md +1 -0
- package/template/skills/zh/{meta/confidence-system → confidence-system}/SKILL.md +1 -0
- package/template/skills/zh/{meta/corner-case-management → corner-case-management}/SKILL.md +1 -0
- package/template/skills/zh/{meta/cross-document-verification → cross-document-verification}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/dashboard-reporting → dashboard-reporting}/SKILL.md +1 -0
- package/template/skills/zh/{meta/data-sensibility → data-sensibility}/SKILL.md +1 -0
- package/template/skills/{en/meta → zh}/document-chunking/SKILL.md +1 -0
- package/template/skills/zh/{meta/document-parsing → document-parsing}/SKILL.md +1 -0
- package/template/skills/{en/meta → zh}/entity-extraction/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/evolution-loop → evolution-loop}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/pdf-review-dashboard → pdf-review-dashboard}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/quality-control → quality-control}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/rule-extraction → rule-extraction}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/rule-graph → rule-graph}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/skill-authoring → skill-authoring}/SKILL.md +1 -0
- package/template/skills/zh/skill-creator/SKILL.md +2 -1
- package/template/skills/zh/skill-to-workflow/SKILL.md +190 -0
- package/template/skills/zh/{meta-meta/task-decomposition → task-decomposition}/SKILL.md +1 -0
- package/template/skills/zh/{meta/tree-processing → tree-processing}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/version-control → version-control}/SKILL.md +1 -0
- package/template/skills/zh/{meta-meta/work-decomposition → work-decomposition}/SKILL.md +15 -4
- package/template/CLAUDE.md +0 -150
- package/template/skills/zh/meta-meta/skill-to-workflow/SKILL.md +0 -188
- /package/template/skills/en/{meta/compliance-judgment → compliance-judgment}/references/output-format.md +0 -0
- /package/template/skills/en/{meta/cross-document-verification → cross-document-verification}/references/contradiction-taxonomy.md +0 -0
- /package/template/skills/en/{meta-meta/dashboard-reporting → dashboard-reporting}/scripts/generate_dashboard.py +0 -0
- /package/template/skills/en/{meta/document-parsing → document-parsing}/references/parser-catalog.md +0 -0
- /package/template/skills/en/{meta-meta/evolution-loop → evolution-loop}/references/convergence-guide.md +0 -0
- /package/template/skills/en/{meta-meta/pdf-review-dashboard → pdf-review-dashboard}/scripts/generate_review.js +0 -0
- /package/template/skills/en/{meta-meta/quality-control → quality-control}/references/qa-layers.md +0 -0
- /package/template/skills/en/{meta-meta/quality-control → quality-control}/references/sampling-strategies.md +0 -0
- /package/template/skills/en/{meta-meta/rule-extraction → rule-extraction}/references/chunking-strategies.md +0 -0
- /package/template/skills/en/{meta-meta/skill-authoring → skill-authoring}/references/skill-format-spec.md +0 -0
- /package/template/skills/en/{meta-meta/skill-to-workflow → skill-to-workflow}/references/worker-llm-catalog.md +0 -0
- /package/template/skills/en/{meta-meta/task-decomposition → task-decomposition}/references/decision-matrix.md +0 -0
- /package/template/skills/en/{meta-meta/version-control → version-control}/references/trace-id-spec.md +0 -0
- /package/template/skills/zh/{meta/compliance-judgment → compliance-judgment}/references/output-format.md +0 -0
- /package/template/skills/zh/{meta/cross-document-verification → cross-document-verification}/references/contradiction-taxonomy.md +0 -0
- /package/template/skills/zh/{meta-meta/dashboard-reporting → dashboard-reporting}/scripts/generate_dashboard.py +0 -0
- /package/template/skills/zh/{meta/document-parsing → document-parsing}/references/parser-catalog.md +0 -0
- /package/template/skills/zh/{meta-meta/evolution-loop → evolution-loop}/references/convergence-guide.md +0 -0
- /package/template/skills/zh/{meta-meta/pdf-review-dashboard → pdf-review-dashboard}/scripts/generate_review.js +0 -0
- /package/template/skills/zh/{meta-meta/quality-control → quality-control}/references/qa-layers.md +0 -0
- /package/template/skills/zh/{meta-meta/quality-control → quality-control}/references/sampling-strategies.md +0 -0
- /package/template/skills/zh/{meta-meta/rule-extraction → rule-extraction}/references/chunking-strategies.md +0 -0
- /package/template/skills/zh/{meta-meta/skill-authoring → skill-authoring}/references/skill-format-spec.md +0 -0
- /package/template/skills/zh/{meta-meta/skill-to-workflow → skill-to-workflow}/references/worker-llm-catalog.md +0 -0
- /package/template/skills/zh/{meta-meta/task-decomposition → task-decomposition}/references/decision-matrix.md +0 -0
- /package/template/skills/zh/{meta-meta/version-control → version-control}/references/trace-id-spec.md +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { BaseTool, ToolResult } from "./base.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* v0.7.5: load a methodology skill's body into the agent's conversation
|
|
5
|
+
* history as a tool result. Pairs with the always-loaded body injection
|
|
6
|
+
* in SkillLoader.formatForContext — that handles the 1-2 architecturally-
|
|
7
|
+
* required skills per phase; consult_skill handles the rest on demand.
|
|
8
|
+
*
|
|
9
|
+
* Validation:
|
|
10
|
+
* - Skill name must be in the current phase's available set (per
|
|
11
|
+
* template/skills/phase_skills.yaml).
|
|
12
|
+
* - Already-always-loaded skills return a hint pointing the agent at the
|
|
13
|
+
* system prompt (don't double-load).
|
|
14
|
+
* - Missing bodies return an error result.
|
|
15
|
+
*
|
|
16
|
+
* Emits `skill_invoked` event with proper skill name on success — replaces
|
|
17
|
+
* the older path-matching regex at engine.js:1297-1313 that produced
|
|
18
|
+
* "(unknown)" spam from rule_skills/<id>/SKILL.md writes.
|
|
19
|
+
*/
|
|
20
|
+
export class ConsultSkillTool extends BaseTool {
|
|
21
|
+
/**
|
|
22
|
+
* @param {import('../workspace.js').Workspace} workspace
|
|
23
|
+
* @param {import('../skill-loader.js').SkillLoader} skillLoader
|
|
24
|
+
* @param {() => string} getCurrentPhase — returns the engine's current phase
|
|
25
|
+
* @param {import('../event-log.js').EventLog} [eventLog] — for skill_invoked emission
|
|
26
|
+
*/
|
|
27
|
+
constructor(workspace, skillLoader, getCurrentPhase, eventLog) {
|
|
28
|
+
super();
|
|
29
|
+
this._workspace = workspace;
|
|
30
|
+
this._skillLoader = skillLoader;
|
|
31
|
+
this._getCurrentPhase = getCurrentPhase;
|
|
32
|
+
this._eventLog = eventLog;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get name() { return "consult_skill"; }
|
|
36
|
+
|
|
37
|
+
get description() {
|
|
38
|
+
return (
|
|
39
|
+
"Load the full body of a methodology skill into your context for the " +
|
|
40
|
+
"current turn. Use when the description tease in the system prompt's " +
|
|
41
|
+
"'Available Methodology Skills' section isn't enough detail to proceed. " +
|
|
42
|
+
"The body lands in your conversation history; subsequent turns can " +
|
|
43
|
+
"reference it via context, or you can re-consult if it ages out. " +
|
|
44
|
+
"Skills already in the 'Loaded Into Your Context' section don't need " +
|
|
45
|
+
"consulting — they're already in your prompt."
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get inputSchema() {
|
|
50
|
+
return {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
name: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Skill name as listed in the system prompt (e.g., 'work-decomposition', 'evolution-loop').",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
required: ["name"],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async execute(input) {
|
|
63
|
+
const name = (input?.name || "").trim();
|
|
64
|
+
if (!name) return new ToolResult("name required (e.g. consult_skill({name: 'work-decomposition'}))", true);
|
|
65
|
+
|
|
66
|
+
const phase = this._getCurrentPhase ? this._getCurrentPhase() : null;
|
|
67
|
+
const { alwaysLoaded, available } = this._skillLoader.getPhaseSkillSet(phase);
|
|
68
|
+
|
|
69
|
+
const alwaysSet = new Set(alwaysLoaded);
|
|
70
|
+
const availableSet = new Set(available);
|
|
71
|
+
|
|
72
|
+
if (alwaysSet.has(name)) {
|
|
73
|
+
return new ToolResult(
|
|
74
|
+
`Skill '${name}' is already always-loaded in your system prompt for phase '${phase}'. ` +
|
|
75
|
+
`Re-read the system prompt's 'Methodology Skills — Loaded Into Your Context' section ` +
|
|
76
|
+
`— the body is there. No separate consult needed.`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!availableSet.has(name)) {
|
|
81
|
+
const sorted = [...availableSet].sort();
|
|
82
|
+
return new ToolResult(
|
|
83
|
+
`Skill '${name}' is not available in phase '${phase}'. ` +
|
|
84
|
+
`Available for this phase: ${sorted.join(", ")}. ` +
|
|
85
|
+
`If you genuinely need this skill, either advance/retreat to a phase ` +
|
|
86
|
+
`where it's available, or check the spelling.`,
|
|
87
|
+
true,
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const body = this._skillLoader.loadSkillBody(name);
|
|
92
|
+
if (!body) {
|
|
93
|
+
return new ToolResult(
|
|
94
|
+
`Skill '${name}' is declared available for phase '${phase}' but its body could not be loaded. ` +
|
|
95
|
+
`This is an engine/template inconsistency — surface to the developer user.`,
|
|
96
|
+
true,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Emit skill_invoked event with the real skill name (replaces the
|
|
101
|
+
// old path-matching regex that produced "(unknown)" spam).
|
|
102
|
+
try {
|
|
103
|
+
this._eventLog?.append?.("skill_invoked", {
|
|
104
|
+
skill: name,
|
|
105
|
+
via_tool: "consult_skill",
|
|
106
|
+
phase,
|
|
107
|
+
});
|
|
108
|
+
} catch { /* event logging is best-effort */ }
|
|
109
|
+
|
|
110
|
+
return new ToolResult(body);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -114,9 +114,10 @@ export class CopyToWorkspaceTool extends BaseTool {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
async _appendManifest(entry) {
|
|
117
|
-
// v0.7.3: refs/manifest.json is a
|
|
118
|
-
// whole read-modify-write
|
|
119
|
-
//
|
|
117
|
+
// v0.7.4 (re-applied from v0.7.3 G1a): refs/manifest.json is a
|
|
118
|
+
// shared coordination path — wrap the whole read-modify-write
|
|
119
|
+
// under the workspace lock so two parallel copy_to_workspace
|
|
120
|
+
// calls (main agent + subagent) don't lose entries.
|
|
120
121
|
return await this._workspace.withSharedLockIfApplicable(MANIFEST_REL, () => {
|
|
121
122
|
const manifestAbs = this._workspace.resolvePath(MANIFEST_REL);
|
|
122
123
|
fs.mkdirSync(path.dirname(manifestAbs), { recursive: true });
|
|
@@ -185,8 +185,23 @@ export class ReleaseTool extends BaseTool {
|
|
|
185
185
|
// file through and emitted a stub on miss. We try to populate from
|
|
186
186
|
// known QC artifact shapes here; if nothing matches, fall through
|
|
187
187
|
// to the existing stub fallback.
|
|
188
|
+
// v0.7.5 G-H3: aggregator now runs if calibSrc is MISSING **or** has
|
|
189
|
+
// empty `historical_accuracy`. v0.7.4 audit (both 贷款 + 资管) shipped
|
|
190
|
+
// empty stubs despite QC data on disk — root cause was the v0.7.2
|
|
191
|
+
// gate only checked file existence; a stub written earlier (e.g., on
|
|
192
|
+
// finalization phase entry) kept the aggregator from firing later.
|
|
188
193
|
const calibSrc = path.join(this._workspace.cwd, "confidence_calibration.json");
|
|
189
|
-
|
|
194
|
+
let shouldAggregate = !fs.existsSync(calibSrc);
|
|
195
|
+
if (!shouldAggregate) {
|
|
196
|
+
try {
|
|
197
|
+
const existing = JSON.parse(fs.readFileSync(calibSrc, "utf-8"));
|
|
198
|
+
const ha = existing?.historical_accuracy;
|
|
199
|
+
if (!ha || (typeof ha === "object" && Object.keys(ha).length === 0)) {
|
|
200
|
+
shouldAggregate = true;
|
|
201
|
+
}
|
|
202
|
+
} catch { shouldAggregate = true; } // corrupt → re-aggregate
|
|
203
|
+
}
|
|
204
|
+
if (shouldAggregate) {
|
|
190
205
|
const aggregated = this._aggregateAccuracyFromOutput();
|
|
191
206
|
if (aggregated && Object.keys(aggregated.historical_accuracy).length > 0) {
|
|
192
207
|
fs.writeFileSync(calibSrc, JSON.stringify(aggregated, null, 2) + "\n", "utf-8");
|
|
@@ -247,6 +262,14 @@ export class ReleaseTool extends BaseTool {
|
|
|
247
262
|
.replace(/\{RULES_LIST\}/g, rulesList);
|
|
248
263
|
fs.writeFileSync(path.join(bundleAbs, "README.md"), readme, "utf-8");
|
|
249
264
|
|
|
265
|
+
// v0.7.5 G-H4: sweep any leftover `.tmpl` files from the bundle dir.
|
|
266
|
+
// template/release/v1/ contains manifest.json.tmpl, catalog.json.tmpl,
|
|
267
|
+
// README.md.tmpl. _copyDir's exclude list (line 119) only filters
|
|
268
|
+
// README.md.tmpl; the other two ride along and persist alongside their
|
|
269
|
+
// populated counterparts. Audit (v0.7.4 贷款) confirmed this regression
|
|
270
|
+
// of v0.7.2 G1d which only handled the v1/ scaffold case.
|
|
271
|
+
this._sweepTmplFiles(bundleAbs);
|
|
272
|
+
|
|
250
273
|
// v0.7.2 1d: clean up the template scaffold dir if a customized
|
|
251
274
|
// release was just written alongside it. Both v0.7.1 audit runs
|
|
252
275
|
// shipped with `output/releases/v1/` (template-derived, .tmpl
|
|
@@ -303,6 +326,25 @@ export class ReleaseTool extends BaseTool {
|
|
|
303
326
|
}
|
|
304
327
|
}
|
|
305
328
|
|
|
329
|
+
/**
|
|
330
|
+
* v0.7.5 G-H4: recursively remove any `*.tmpl` files from a directory.
|
|
331
|
+
* Used after populating a release bundle to drop template stubs that
|
|
332
|
+
* weren't filtered by the initial copy's exclude list. Idempotent.
|
|
333
|
+
*/
|
|
334
|
+
_sweepTmplFiles(dir) {
|
|
335
|
+
try {
|
|
336
|
+
if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) return;
|
|
337
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
338
|
+
const entryPath = path.join(dir, entry.name);
|
|
339
|
+
if (entry.isDirectory()) {
|
|
340
|
+
this._sweepTmplFiles(entryPath);
|
|
341
|
+
} else if (entry.isFile() && entry.name.endsWith(".tmpl")) {
|
|
342
|
+
try { fs.unlinkSync(entryPath); } catch { /* best-effort */ }
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
} catch { /* best-effort */ }
|
|
346
|
+
}
|
|
347
|
+
|
|
306
348
|
_findLatestWorkflow(ruleId) {
|
|
307
349
|
// Canonical: workflows/<ruleId>/workflow_v#.py (subdirectory layout)
|
|
308
350
|
const wfDir = path.join(this._workspace.cwd, "workflows", ruleId);
|
|
@@ -338,10 +380,95 @@ export class ReleaseTool extends BaseTool {
|
|
|
338
380
|
}
|
|
339
381
|
} catch { /* manifest unreadable; skip */ }
|
|
340
382
|
}
|
|
383
|
+
|
|
384
|
+
// v0.7.5 G-H2: master / grouped workflow pattern. Agent shipped a
|
|
385
|
+
// single workflow folder (e.g., workflows/master/ or workflows/
|
|
386
|
+
// bank_wm_compliance/) declaring `source_rules: [R001, R002, ...]`
|
|
387
|
+
// in its SKILL.md / workflow.md / config.json. The manifest writer
|
|
388
|
+
// should credit this rule_id as covered by that workflow.
|
|
389
|
+
//
|
|
390
|
+
// Walk workflows/ subdirs looking for a source_rules declaration
|
|
391
|
+
// that includes this ruleId. Return the first matching workflow file.
|
|
392
|
+
// Audit (v0.7.4 贷款 session) confirmed manifest under-counted:
|
|
393
|
+
// catalog had 15 rules; manifest only listed R001 because R002-R015
|
|
394
|
+
// weren't found as standalone workflows.
|
|
395
|
+
for (const entry of fs.readdirSync(flatRoot, { withFileTypes: true })) {
|
|
396
|
+
if (!entry.isDirectory()) continue;
|
|
397
|
+
if (entry.name === ruleId) continue; // already checked above
|
|
398
|
+
const subDir = path.join(flatRoot, entry.name);
|
|
399
|
+
const declaredRules = this._readWorkflowSourceRules(subDir);
|
|
400
|
+
if (declaredRules.includes(ruleId)) {
|
|
401
|
+
// Find the workflow entry file in this dir
|
|
402
|
+
const subFiles = fs.readdirSync(subDir);
|
|
403
|
+
const versioned = subFiles.filter((f) => /^workflow_v\d+\.py$/.test(f)).sort();
|
|
404
|
+
if (versioned.length > 0) return path.join(subDir, versioned[versioned.length - 1]);
|
|
405
|
+
const any = subFiles.find((f) => f.endsWith(".py"));
|
|
406
|
+
if (any) return path.join(subDir, any);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
341
409
|
}
|
|
342
410
|
return null;
|
|
343
411
|
}
|
|
344
412
|
|
|
413
|
+
/**
|
|
414
|
+
* v0.7.5 G-H2: read a workflow directory's source_rules declaration.
|
|
415
|
+
* Checks SKILL.md / workflow.md frontmatter (`source_rules: [...]`)
|
|
416
|
+
* and config.json (`source_rules`, `rules`, or `rule_ids` field).
|
|
417
|
+
* Returns array of canonical rule IDs.
|
|
418
|
+
*/
|
|
419
|
+
_readWorkflowSourceRules(workflowDir) {
|
|
420
|
+
const ids = new Set();
|
|
421
|
+
try {
|
|
422
|
+
const files = fs.readdirSync(workflowDir);
|
|
423
|
+
|
|
424
|
+
// Frontmatter sources
|
|
425
|
+
for (const fname of files) {
|
|
426
|
+
if (!/^(skill|workflow)\.md$/i.test(fname)) continue;
|
|
427
|
+
let content;
|
|
428
|
+
try { content = fs.readFileSync(path.join(workflowDir, fname), "utf-8"); } catch { continue; }
|
|
429
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
430
|
+
if (!fmMatch) continue;
|
|
431
|
+
const fm = fmMatch[1];
|
|
432
|
+
// Inline form
|
|
433
|
+
const inlineMatch = fm.match(/^source_rules\s*:\s*\[([^\]]*)\]\s*$/m);
|
|
434
|
+
if (inlineMatch) {
|
|
435
|
+
inlineMatch[1].split(",").map(s => s.trim().replace(/^["']|["']$/g, ""))
|
|
436
|
+
.filter(Boolean).forEach(s => {
|
|
437
|
+
const m = s.match(/^R0*(\d+)$/i);
|
|
438
|
+
if (m) ids.add(`R${String(parseInt(m[1], 10)).padStart(3, "0")}`);
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
// Block form
|
|
442
|
+
const blockMatch = fm.match(/^source_rules\s*:\s*\n((?:[ \t]+-\s+\S+\s*\n?)+)/m);
|
|
443
|
+
if (blockMatch) {
|
|
444
|
+
blockMatch[1].split("\n").forEach(line => {
|
|
445
|
+
const m = line.match(/^[ \t]+-\s+["']?(R0*\d+)["']?\s*$/i);
|
|
446
|
+
if (m) {
|
|
447
|
+
const n = m[1].match(/R0*(\d+)/i);
|
|
448
|
+
if (n) ids.add(`R${String(parseInt(n[1], 10)).padStart(3, "0")}`);
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// Config.json sources
|
|
455
|
+
const configPath = path.join(workflowDir, "config.json");
|
|
456
|
+
if (fs.existsSync(configPath)) {
|
|
457
|
+
try {
|
|
458
|
+
const data = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
459
|
+
const rules = Array.isArray(data?.source_rules) ? data.source_rules :
|
|
460
|
+
Array.isArray(data?.rules) ? data.rules :
|
|
461
|
+
Array.isArray(data?.rule_ids) ? data.rule_ids : [];
|
|
462
|
+
for (const r of rules) {
|
|
463
|
+
const m = String(r).match(/^R0*(\d+)$/i);
|
|
464
|
+
if (m) ids.add(`R${String(parseInt(m[1], 10)).padStart(3, "0")}`);
|
|
465
|
+
}
|
|
466
|
+
} catch { /* ignore */ }
|
|
467
|
+
}
|
|
468
|
+
} catch { /* dir unreadable */ }
|
|
469
|
+
return [...ids];
|
|
470
|
+
}
|
|
471
|
+
|
|
345
472
|
_resolveFixture(rel) {
|
|
346
473
|
// Try samples/ first (workspace, then project), then plain workspace path
|
|
347
474
|
const candidates = [];
|
|
@@ -30,9 +30,7 @@ export class WorkspaceFileTool extends BaseTool {
|
|
|
30
30
|
"Read, write, or list files. " +
|
|
31
31
|
"scope='workspace' (default): KC's working directory for rules, skills, workflows, results. " +
|
|
32
32
|
"scope='project': the user's project folder where KC was launched — source regulations and samples live here. " +
|
|
33
|
-
"Operations: read (returns file content), write (creates/overwrites a file), list (shows directory contents).
|
|
34
|
-
"read returns up to 50,000 chars per call; longer files are truncated. " +
|
|
35
|
-
"For full reads of regulation/rule documents (typically smaller than this cap), prefer this tool over sandbox_exec."
|
|
33
|
+
"Operations: read (returns file content), write (creates/overwrites a file), list (shows directory contents)."
|
|
36
34
|
);
|
|
37
35
|
}
|
|
38
36
|
|
|
@@ -163,10 +161,12 @@ export class WorkspaceFileTool extends BaseTool {
|
|
|
163
161
|
return new ToolResult(msg);
|
|
164
162
|
};
|
|
165
163
|
|
|
166
|
-
// v0.7.3: route writes to shared
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
164
|
+
// v0.7.4 (re-applied from v0.7.3 G1a): route writes to shared
|
|
165
|
+
// coordination paths (rules/catalog.json, tasks.json,
|
|
166
|
+
// refs/manifest.json, etc.) through the workspace lock so
|
|
167
|
+
// concurrent writers serialize. No-op for non-shared paths and
|
|
168
|
+
// for project-scope writes (project dir is the user's, not
|
|
169
|
+
// shared engine state).
|
|
170
170
|
if (scope === "workspace") {
|
|
171
171
|
return await this._workspace.withSharedLockIfApplicable(filePath, doWrite);
|
|
172
172
|
}
|
package/src/config.js
CHANGED
|
@@ -90,7 +90,7 @@ export function loadSettings(workspacePath) {
|
|
|
90
90
|
tier3: env.TIER3 || gc.tiers?.tier3 || "",
|
|
91
91
|
tier4: env.TIER4 || gc.tiers?.tier4 || "",
|
|
92
92
|
|
|
93
|
-
// VLM tiers (vision/OCR models). v0.7.
|
|
93
|
+
// VLM tiers (vision/OCR models). v0.7.4: accept OCR_MODEL_TIER* as
|
|
94
94
|
// alias since template/.env.template + initializer.js seed that name.
|
|
95
95
|
// VLM_TIER* takes precedence when both are set.
|
|
96
96
|
vlmTier1: env.VLM_TIER1 || env.OCR_MODEL_TIER1 || gc.vlm_tiers?.tier1 || "",
|
package/template/AGENT.md
CHANGED
|
@@ -1,20 +1,195 @@
|
|
|
1
|
-
# AGENT.md — Project Context
|
|
1
|
+
# AGENT.md — KC Project Context
|
|
2
2
|
|
|
3
|
-
This file is
|
|
4
|
-
|
|
3
|
+
This file is injected into the agent's system prompt every turn. The
|
|
4
|
+
top sections describe KC's design philosophy + your mission (static
|
|
5
|
+
across sessions); the bottom sections are per-project memory you
|
|
6
|
+
update as you learn about this specific business scenario.
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
> **Skill priority**: meta-meta skills are architectural — they
|
|
9
|
+
> override meta (how-to) skills when guidance conflicts. The
|
|
10
|
+
> architect's frame bounds the technique. If you find yourself
|
|
11
|
+
> rationalizing past a meta-meta principle to follow a meta procedure,
|
|
12
|
+
> stop — the frame should bound the technique, not the other way
|
|
13
|
+
> around. Each skill declares its tier in YAML frontmatter (`tier:
|
|
14
|
+
> meta-meta` or `tier: meta`).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# KC Reborn — Document Verification Workspace
|
|
19
|
+
|
|
20
|
+
## What This Workspace Is
|
|
21
|
+
|
|
22
|
+
You are a coding agent tasked with building a document verification app for the developer user's specific business scenario. The meta skills in `skills/` encode the methodology of experienced verification system architects and business analysts. You bring the intelligence and judgment to apply this methodology to the specific case at hand.
|
|
23
|
+
|
|
24
|
+
Your goal: build a verification system that starts with you doing the work, then gradually distills your capability into cheap, fast workflows powered by worker LLMs. You are the ground truth. The workflows you create are the deliverables.
|
|
25
|
+
|
|
26
|
+
## Roles
|
|
27
|
+
|
|
28
|
+
- **Developer user**: The human you serve. They are a domain expert (e.g., tech lead at a bank's loan department). They provide the rules, the documents, and the business context. Discuss decisions with them.
|
|
29
|
+
- **You (the coding agent)**: You are both the Builder (creating skills and workflows) and the Observer (judging quality). You do the verification first, prove it works, then teach smaller models to replicate your results.
|
|
30
|
+
- **Worker LLMs**: The performers. Models configured in `.env` (TIER1 through TIER4) that will execute the workflows you build. Your job is to find the smallest model that works for each task.
|
|
31
|
+
|
|
32
|
+
## Workspace Layout
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Rules/ — Regulation documents, compliance notes from the developer user
|
|
36
|
+
Samples/ — Sample documents for testing (your training set)
|
|
37
|
+
Input/ — Production document batches awaiting verification
|
|
38
|
+
Output/ — Verification results
|
|
39
|
+
skills/ — Methodology skills (current phase's available set)
|
|
40
|
+
.env — Configuration: API keys, model tiers, thresholds, language
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Note: KC's session workspace under `~/.kc_agent/workspaces/<sessionId>/`
|
|
44
|
+
uses lowercase counterparts (`rules/`, `samples/`, `input/`, `output/`,
|
|
45
|
+
`logs/`, `workflows/`, `rule_skills/`) — these are runtime-internal and
|
|
46
|
+
separate from this project's user-facing folders above. The asymmetry
|
|
47
|
+
is intentional: title-case for human-facing project dirs, lowercase for
|
|
48
|
+
KC's working state.
|
|
49
|
+
|
|
50
|
+
## Your Mission
|
|
51
|
+
|
|
52
|
+
Follow this lifecycle. Each step references the skill(s) to consult.
|
|
53
|
+
Always-loaded skills are already in your system prompt (above); other
|
|
54
|
+
skills are listed under "Available Methodology Skills" and require
|
|
55
|
+
`consult_skill(name)` to load the body.
|
|
56
|
+
|
|
57
|
+
1. **Bootstrap** → `bootstrap-workspace` (always loaded). Understand the business scenario, read Rules/, scan Samples/, configure .env with the developer user.
|
|
58
|
+
2. **Extract Rules** → `rule-extraction` (always loaded). Decompose regulation documents into atomic, testable verification rules.
|
|
59
|
+
3. **Decompose Tasks** → `work-decomposition` (always loaded in skill_authoring). Decide ordering, grouping, and TaskBoard structure.
|
|
60
|
+
4. **Map Rule Relationships** → `consult_skill("rule-graph")`. Identify shared entities, dependencies, and conflicts between rules. Each rule stays independently executable.
|
|
61
|
+
5. **Write Rule Skills** → `skill-authoring` (always loaded in skill_authoring). Write each rule into a skill folder. Before writing extraction logic for a new document type, `consult_skill("data-sensibility")` to observe the data first.
|
|
62
|
+
6. **Test Skills** → Apply each skill to Samples/. `evolution-loop` is always loaded in skill_testing — use it to diagnose failures and iterate. Continue until accuracy meets SKILL_ACCURACY threshold in .env.
|
|
63
|
+
7. **Distill to Workflows** → `skill-to-workflow` (always loaded in distillation). Convert proven skills into Python code + worker LLM prompts. Test workflows against your own results as ground truth. Iterate until WORKFLOW_ACCURACY is met.
|
|
64
|
+
8. **Production QC** → `quality-control` (always loaded in production_qc). Run workflows on Input/. Sample and review results based on confidence scores. For multi-document cases, `consult_skill("cross-document-verification")`. Use `evolution-loop` when quality drops.
|
|
65
|
+
9. **Stabilize** → Gradually reduce monitoring as workflows prove reliable. Only intervene when rules change or quality drops.
|
|
66
|
+
10. **Report** → `consult_skill("dashboard-reporting")`. Generate HTML dashboards so the developer user can see results, progress, and issues. Ensure dashboards include feedback collection mechanisms for users.
|
|
67
|
+
|
|
68
|
+
Throughout: `consult_skill("version-control")` to track changes. `consult_skill("corner-case-management")` to handle edge cases without polluting workflows.
|
|
69
|
+
|
|
70
|
+
## Core Principles
|
|
71
|
+
|
|
72
|
+
- **Minimum viable model**: Always use the smallest, cheapest, fastest model that meets the accuracy threshold. Start simple, escalate only when necessary.
|
|
73
|
+
- **JIT structure**: Do not design schemas or formats prematurely. Define them when needed, keep them consistent once defined.
|
|
74
|
+
- **OTF evolution**: The system you build today may look completely different tomorrow. Embrace change.
|
|
75
|
+
- **Skills before workflows**: Prove each rule works as a skill (you executing it) before distilling into code + worker LLM prompts.
|
|
76
|
+
- **Log everything**: Every test iteration, every evolution decision, every version change. Both JSON (machine-readable) and plain text (human-readable).
|
|
77
|
+
|
|
78
|
+
## How to Use Skills
|
|
79
|
+
|
|
80
|
+
Skills are loaded in two ways:
|
|
81
|
+
|
|
82
|
+
1. **Always loaded** — bodies are inline in this system prompt above the project orientation. These are the architecturally-required skills for the current phase. Treat them as authoritative.
|
|
83
|
+
2. **Available — call consult_skill(name)** — listed by name + description in the system prompt under "Available Methodology Skills." Call `consult_skill("<name>")` to load the body into your conversation history when the description tease isn't enough.
|
|
84
|
+
|
|
85
|
+
The skill body is the methodology. Skills convey philosophy and decision frameworks. Adapt them to the specific business case. Do not follow them rigidly.
|
|
86
|
+
|
|
87
|
+
## Communication with Developer User
|
|
88
|
+
|
|
89
|
+
- **Proactively discuss**: rule granularity, accuracy thresholds, model selection, edge cases.
|
|
90
|
+
- **Report progress**: after each testing round, share results and next steps.
|
|
91
|
+
- **Escalate**: when you cannot resolve an issue after iterating, surface it with evidence.
|
|
92
|
+
- **Ask**: the developer user is a domain expert. When in doubt about a rule's intent, ask.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
# KC Reborn — 文档核查工作区
|
|
97
|
+
|
|
98
|
+
> **技能优先级**: meta-meta 技能是架构层面 —— 当指导冲突时,
|
|
99
|
+
> meta-meta 凌驾于 meta (技法层面) 之上。架构师的框架约束技法。
|
|
100
|
+
> 如果你发现自己在为了遵循一条 meta 程序而绕开一条 meta-meta
|
|
101
|
+
> 原则,停下 —— 框架应当约束技法,而不是反过来。每个技能在
|
|
102
|
+
> YAML frontmatter 中声明自己的层级 (`tier: meta-meta` 或
|
|
103
|
+
> `tier: meta`)。
|
|
104
|
+
|
|
105
|
+
## 这是什么
|
|
106
|
+
|
|
107
|
+
你是一个编程智能体,负责为开发者用户的具体业务场景构建文档核查应用。`skills/` 中的元技能编码了资深核查系统架构师和业务分析师的方法论。你负责运用智慧和判断力,将这些方法论应用到具体场景中。
|
|
108
|
+
|
|
109
|
+
你的目标:构建一个核查系统,先由你亲自执行核查工作,然后逐步将你的能力蒸馏为由 Worker LLM(执行模型)驱动的低成本、高速度的工作流。你是基准真值。你创建的工作流是最终交付物。
|
|
110
|
+
|
|
111
|
+
## 角色定义
|
|
112
|
+
|
|
113
|
+
- **开发者用户**:你服务的人。他们是领域专家(如银行信贷部门的技术负责人)。他们提供规则、文档和业务背景。与他们讨论决策。
|
|
114
|
+
- **你(编程智能体)**:你既是构建者(创建技能和工作流),也是观察者(评判质量)。你先执行核查,证明方法可行,再教小模型复现你的结果。
|
|
115
|
+
- **Worker LLM**:执行者。在 `.env` 中配置的模型(TIER1到TIER4),将执行你构建的工作流。你的任务是为每项工作找到能胜任的最小模型。
|
|
116
|
+
|
|
117
|
+
## 工作区结构
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Rules/ — 法规文件、开发者用户的合规注释
|
|
121
|
+
Samples/ — 用于测试的样本文件(你的训练集)
|
|
122
|
+
Input/ — 等待核查的生产批次文件
|
|
123
|
+
Output/ — 核查结果
|
|
124
|
+
skills/ — 当前阶段可用的方法论技能
|
|
125
|
+
.env — 配置:API密钥、模型层级、阈值、语言
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
注:KC 在 `~/.kc_agent/workspaces/<sessionId>/` 下的会话工作区使用
|
|
129
|
+
小写对应目录(`rules/`、`samples/`、`input/`、`output/`、`logs/`、
|
|
130
|
+
`workflows/`、`rule_skills/`)—— 这些是运行时内部目录,与本项目上面
|
|
131
|
+
那些用户可见的目录是分开的。这种大小写不对称是有意的:项目里给人看
|
|
132
|
+
的目录用首字母大写;KC 自己的工作状态用小写。
|
|
133
|
+
|
|
134
|
+
## 你的使命
|
|
135
|
+
|
|
136
|
+
遵循以下生命周期。常驻加载的技能已经在你的系统提示词中;其他技能在"可用方法论技能"清单里列出,调 `consult_skill(name)` 才能加载正文。
|
|
137
|
+
|
|
138
|
+
1. **初始化** → `bootstrap-workspace`(常驻)。理解业务场景,阅读 Rules/,浏览 Samples/,与开发者用户配置 .env。
|
|
139
|
+
2. **提取规则** → `rule-extraction`(常驻)。将法规文件分解为原子级、可测试的核查规则。
|
|
140
|
+
3. **任务分解** → `work-decomposition`(skill_authoring 常驻)。决定顺序、分组以及 TaskBoard 结构。
|
|
141
|
+
4. **构建规则图谱** → `consult_skill("rule-graph")`。识别规则间的共享实体、依赖关系和潜在冲突。每条规则保持独立可执行。
|
|
142
|
+
5. **编写规则技能** → `skill-authoring`(skill_authoring 常驻)。将每条规则写入技能文件夹。编写新文档类型的提取逻辑前,先 `consult_skill("data-sensibility")` 观察数据。
|
|
143
|
+
6. **测试技能** → 在 Samples/ 上应用每个技能。`evolution-loop` 在 skill_testing 常驻 —— 用它诊断失败并迭代。直到准确率达到 .env 中的 SKILL_ACCURACY 阈值。
|
|
144
|
+
7. **蒸馏为工作流** → `skill-to-workflow`(distillation 常驻)。将验证过的技能转化为 Python 代码 + Worker LLM 提示词。用你自己的结果作为基准测试工作流。迭代直到达到 WORKFLOW_ACCURACY。
|
|
145
|
+
8. **生产质控** → `quality-control`(production_qc 常驻)。在 Input/ 上运行工作流。根据置信度分数抽样审查结果。涉及多文档案件时,`consult_skill("cross-document-verification")`。质量下降时使用 `evolution-loop`。
|
|
146
|
+
9. **稳定运行** → 随着工作流稳定,逐步降低监控频率。仅在规则变更或质量下降时介入。
|
|
147
|
+
10. **报告** → `consult_skill("dashboard-reporting")`。生成 HTML 仪表板,让开发者用户直观地看到结果、进度和问题。确保仪表盘内置用户反馈收集机制。
|
|
148
|
+
|
|
149
|
+
全程:用 `consult_skill("version-control")` 跟踪所有变更,用 `consult_skill("corner-case-management")` 处理边缘案例,不要污染主工作流。
|
|
150
|
+
|
|
151
|
+
## 核心原则
|
|
152
|
+
|
|
153
|
+
- **最小可用模型**:始终使用能达到准确率阈值的最小、最便宜、最快的模型。从简单开始,必要时才升级。
|
|
154
|
+
- **即时结构(JIT)**:不要过早设计数据结构或格式。需要时定义,定义后保持一致。
|
|
155
|
+
- **即时演进(OTF)**:你今天构建的系统明天可能面目全非。拥抱变化。
|
|
156
|
+
- **先技能后工作流**:先证明每条规则作为技能(你执行)可行,再蒸馏为代码 + Worker LLM 提示词。
|
|
157
|
+
- **记录一切**:每次测试迭代、每个演进决策、每次版本变更。同时保存 JSON(机器可读)和纯文本(人类可读)。
|
|
158
|
+
|
|
159
|
+
## 如何使用技能
|
|
160
|
+
|
|
161
|
+
技能通过两种方式加载:
|
|
162
|
+
|
|
163
|
+
1. **常驻加载** —— 技能正文直接出现在本系统提示词里、项目说明的上方。这些是当前阶段架构上必需的技能,把它们的内容当作权威指导。
|
|
164
|
+
2. **可用 —— 调 consult_skill(name)** —— 在系统提示词的"可用方法论技能"清单里按名字 + 描述列出。当描述简介不够用时,调 `consult_skill("<名字>")` 把技能正文加载到你的对话历史里。
|
|
165
|
+
|
|
166
|
+
技能正文是方法论本身。技能传达的是理念和决策框架。请根据具体业务场景灵活运用,不要机械照搬。
|
|
167
|
+
|
|
168
|
+
## 与开发者用户的沟通
|
|
169
|
+
|
|
170
|
+
- **主动讨论**:规则粒度、准确率阈值、模型选择、边缘案例。
|
|
171
|
+
- **汇报进度**:每轮测试后,分享结果和下一步计划。
|
|
172
|
+
- **升级问题**:迭代后仍无法解决的问题,附带证据提交给开发者用户。
|
|
173
|
+
- **多问**:开发者用户是领域专家。对规则意图有疑问时,问他们。
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Per-project memory (you maintain this section)
|
|
178
|
+
|
|
179
|
+
The sections below are your scratchpad for this specific project. Update them as you learn about the business scenario, decisions, and edge cases. They persist across your sessions on this project.
|
|
180
|
+
|
|
181
|
+
### Project
|
|
7
182
|
|
|
8
183
|
<!-- What domain? What regulations? What documents? Fill this in during bootstrap. -->
|
|
9
184
|
|
|
10
|
-
|
|
185
|
+
### Decisions
|
|
11
186
|
|
|
12
187
|
<!-- Key decisions made with the developer user. Rule granularity, accuracy targets, model choices, scope boundaries. -->
|
|
13
188
|
|
|
14
|
-
|
|
189
|
+
### Domain Notes
|
|
15
190
|
|
|
16
191
|
<!-- Terminology, document formats, naming conventions, edge cases specific to this domain. -->
|
|
17
192
|
|
|
18
|
-
|
|
193
|
+
### User Preferences
|
|
19
194
|
|
|
20
195
|
<!-- How the developer user prefers to communicate. Reporting format, language, level of detail. -->
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bootstrap-workspace
|
|
3
|
+
tier: meta-meta
|
|
3
4
|
description: Initialize and configure a document verification workspace. Use when a developer user first opens this workspace, when .env needs configuration, or when the business scenario needs to be understood. Guides the coding agent through reading regulation documents, understanding the developer user's business context, configuring model tiers and thresholds, and establishing the working relationship. Covers initial conversation with developer user to scope the verification task, set expectations, and agree on checkpoints.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: compliance-judgment
|
|
3
|
+
tier: meta
|
|
3
4
|
description: Determine whether extracted entities comply with verification rules. Use after entity extraction to make the pass/fail judgment for each rule on each document. Covers translating natural language rules into executable logic, choosing between Python calculation and LLM semantic judgment, and producing actionable comments on failures. Also use when designing the judgment step of a workflow or when a rule's judgment logic needs debugging.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: confidence-system
|
|
3
|
+
tier: meta
|
|
3
4
|
description: Design and calibrate confidence scoring for extraction and verification results. Use when building any workflow that needs to quantify trust in its output, when setting up quality control sampling thresholds, or when calibrating existing confidence scores against actual accuracy. Confidence is the bridge between workflows and quality control — high confidence means less review, low confidence means more review. Also use when the quality control skill reports that confidence scores do not correlate with actual correctness.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: corner-case-management
|
|
3
|
+
tier: meta
|
|
3
4
|
description: Identify, catalog, and handle corner cases that do not fit the mainstream verification workflow. Use when the evolution loop classifies a failure as a corner case (affecting less than ~10% of documents), when adding a new edge case to the registry, or when deciding whether a corner case should be promoted to a systemic fix. Also use when designing the corner case detection mechanism for a workflow.
|
|
4
5
|
---
|
|
5
6
|
|
package/template/skills/en/{meta/cross-document-verification → cross-document-verification}/SKILL.md
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cross-document-verification
|
|
3
|
+
tier: meta
|
|
3
4
|
description: Perform case-level analysis across multiple documents for the same transaction. Use when documents do not exist in isolation — main contracts have appendices, loan applications come bundled with income certificates, bank statements, credit reports, and property appraisals. Use to build comparison matrices, detect contradictions (hard mismatches and soft implausibilities), classify severity, and flag fraud signals. Also use when user or end-user reports a cross-document inconsistency — these reports are ground truth and take priority over agent judgment.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dashboard-reporting
|
|
3
|
+
tier: meta-meta
|
|
3
4
|
description: Generate HTML dashboards for developer users to visualize verification results, system progress, and quality metrics. Use when a testing round completes, when production batches finish processing, when the developer user wants to see the system's status, or at any point where visual reporting would help communicate progress. Dashboards should be self-contained HTML files that can be opened by double-clicking. Also use when the developer user asks about results, accuracy, or system health.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: data-sensibility
|
|
3
|
+
tier: meta
|
|
3
4
|
description: Build intuition about document data before writing extraction logic. Use before designing any extraction schema or regex pattern, when onboarding a new document type, or when extraction accuracy is unexpectedly low and you suspect a data assumption is wrong. Covers systematic observation of raw documents, spot-checking extracted results, distribution analysis, and recognizing suspicious patterns. If you are about to write code that touches document data and you have not read at least five documents end-to-end, stop and use this skill first.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: document-parsing
|
|
3
|
+
tier: meta
|
|
3
4
|
description: Parse source documents into machine-readable text with maximum fidelity. Use when processing any document in Samples/ or Input/ for the first time, when parsed text quality is poor, or when tables and charts need special handling. Covers multi-level parser selection from simple text extraction to OCR and vision models. Also use when a verification rule fails due to parsing issues (garbled text, missing tables, mangled layouts) and the parser needs to be upgraded for that document type.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: entity-extraction
|
|
3
|
+
tier: meta
|
|
3
4
|
description: Extract specific entities, values, and text segments from documents as required by verification rules. Use after tree processing has located the relevant section, when a rule needs a specific number, date, name, amount, clause, or any domain-specific entity extracted. Covers extraction method selection (regex vs LLM), schema design, postprocessing, and confidence annotation. Also use when designing the extraction step of a workflow for worker LLMs.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: evolution-loop
|
|
3
|
+
tier: meta-meta
|
|
3
4
|
description: Drive continuous improvement of skills and workflows through the diagnose-classify-fix-retest cycle. Use after any testing round reveals failures, when production quality control flags issues, or when accuracy drops below thresholds. Covers failure analysis, distinguishing systemic issues from corner cases, deciding whether to rewrite or patch, and knowing when to stop iterating. The evolution loop is the heartbeat of the system. Also use when transitioning between lifecycle phases (skill testing, workflow testing, production monitoring).
|
|
4
5
|
---
|
|
5
6
|
|