@x12i/memorix-skills 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/classify.d.ts +26 -0
- package/dist/classify.d.ts.map +1 -0
- package/dist/classify.js +85 -0
- package/dist/classify.js.map +1 -0
- package/dist/create-memorix-skills.d.ts +10 -0
- package/dist/create-memorix-skills.d.ts.map +1 -1
- package/dist/create-memorix-skills.js +17 -0
- package/dist/create-memorix-skills.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +21 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +126 -0
- package/dist/internal.js.map +1 -0
- package/internal/audit-prompt.md +28 -0
- package/internal/audit-result.md +28 -0
- package/internal/fix-attempt.md +17 -0
- package/internal/improve-prompt.md +17 -0
- package/internal/investigate-audit.md +9 -0
- package/internal/investigate-context.md +9 -0
- package/internal/investigate-contract.md +9 -0
- package/internal/investigate-execution.md +9 -0
- package/internal/investigate-inputs.md +9 -0
- package/internal/investigate-instructions.md +9 -0
- package/internal/investigate-provenance.md +9 -0
- package/internal/investigate-response.md +9 -0
- package/internal/investigate-synthesis.md +19 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -9,6 +9,19 @@ This package **only runs a skill**:
|
|
|
9
9
|
|
|
10
10
|
It does not orchestrate pipelines, land records, or call Nexum.
|
|
11
11
|
|
|
12
|
+
## Internal actions
|
|
13
|
+
|
|
14
|
+
`internal/{key}.md` is a helper call, not a sequence step. The package ships `audit-prompt`, `audit-result`, and `improve-prompt`. A file in the agent folder `internal/` replaces the same key or adds an action.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
const response = await skills.runInternal({
|
|
18
|
+
action: "audit-prompt",
|
|
19
|
+
input: { prompt: "Write the note." },
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`listInternalActions(skillsDir)` and `renderInternalAction(action, input)` prepare the call without sending it.
|
|
24
|
+
|
|
12
25
|
## Usage
|
|
13
26
|
|
|
14
27
|
```ts
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ClassifyCandidate = {
|
|
2
|
+
skill: string;
|
|
3
|
+
score: number;
|
|
4
|
+
};
|
|
5
|
+
export type ClassifyMatch = {
|
|
6
|
+
status: "match";
|
|
7
|
+
skill: string;
|
|
8
|
+
confidence: number;
|
|
9
|
+
auditSkill?: string;
|
|
10
|
+
steps: string[];
|
|
11
|
+
promptVersion: string;
|
|
12
|
+
candidates: ClassifyCandidate[];
|
|
13
|
+
};
|
|
14
|
+
export type ClassifyMiss = {
|
|
15
|
+
status: "ambiguous" | "none";
|
|
16
|
+
candidates: ClassifyCandidate[];
|
|
17
|
+
};
|
|
18
|
+
/** Same hash as skill-process `promptVersion`, so a classified skill names that version. */
|
|
19
|
+
export declare function instructionVersion(templateBody: string, catalogs?: Record<string, unknown>): string;
|
|
20
|
+
export declare function instructionScore(prompt: string, body: string): number;
|
|
21
|
+
/**
|
|
22
|
+
* Match a rendered request to the processing skill whose instruction text it contains.
|
|
23
|
+
* A winner needs a score of at least 0.6 and a lead of 0.15.
|
|
24
|
+
*/
|
|
25
|
+
export declare function classifyPrompt(agentDir: string, prompt: string, catalogs?: Record<string, unknown>): Promise<ClassifyMatch | ClassifyMiss>;
|
|
26
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../src/classify.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC;IAC7B,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC,CAAC;AAIF,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CASvG;AASD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAOrE;AAqBD;;;GAGG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,OAAO,CAAC,aAAa,GAAG,YAAY,CAAC,CAyBvC"}
|
package/dist/classify.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { listSkillCatalog, loadSkill } from "./skills.js";
|
|
5
|
+
const CATALOG_REF = /catalogs\.(?:\[([a-z0-9]+(?:-[a-z0-9]+)*)\]|([a-z0-9]+(?:-[a-z0-9]+)*))/g;
|
|
6
|
+
/** Same hash as skill-process `promptVersion`, so a classified skill names that version. */
|
|
7
|
+
export function instructionVersion(templateBody, catalogs = {}) {
|
|
8
|
+
const slice = {};
|
|
9
|
+
for (const match of templateBody.matchAll(CATALOG_REF)) {
|
|
10
|
+
const id = match[1] || match[2];
|
|
11
|
+
if (id)
|
|
12
|
+
slice[id] = catalogs[id];
|
|
13
|
+
}
|
|
14
|
+
const ordered = {};
|
|
15
|
+
for (const id of Object.keys(slice).sort())
|
|
16
|
+
ordered[id] = slice[id];
|
|
17
|
+
return createHash("sha256").update(templateBody).update("\0").update(JSON.stringify(ordered)).digest("hex").slice(0, 16);
|
|
18
|
+
}
|
|
19
|
+
function segments(body) {
|
|
20
|
+
return body
|
|
21
|
+
.split(/\{\{[\s\S]*?\}\}/)
|
|
22
|
+
.map((part) => part.replace(/\s+/g, " ").trim())
|
|
23
|
+
.filter((part) => part.length >= 20);
|
|
24
|
+
}
|
|
25
|
+
export function instructionScore(prompt, body) {
|
|
26
|
+
const parts = segments(body);
|
|
27
|
+
const total = parts.reduce((sum, part) => sum + part.length, 0);
|
|
28
|
+
if (!total)
|
|
29
|
+
return 0;
|
|
30
|
+
const hay = prompt.replace(/\s+/g, " ");
|
|
31
|
+
const matched = parts.reduce((sum, part) => sum + (hay.includes(part) ? part.length : 0), 0);
|
|
32
|
+
return matched / total;
|
|
33
|
+
}
|
|
34
|
+
async function stepsUsing(agentDir, skill) {
|
|
35
|
+
const dir = path.join(agentDir, "steps");
|
|
36
|
+
let names = [];
|
|
37
|
+
try {
|
|
38
|
+
names = await readdir(dir);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const hits = [];
|
|
44
|
+
const needleA = `"${skill}"`;
|
|
45
|
+
const needleB = `'${skill}'`;
|
|
46
|
+
for (const name of names) {
|
|
47
|
+
if (!name.endsWith(".mjs"))
|
|
48
|
+
continue;
|
|
49
|
+
const text = await readFile(path.join(dir, name), "utf8");
|
|
50
|
+
if (text.includes(needleA) || text.includes(needleB))
|
|
51
|
+
hits.push(name.slice(0, -4));
|
|
52
|
+
}
|
|
53
|
+
return hits.sort();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Match a rendered request to the processing skill whose instruction text it contains.
|
|
57
|
+
* A winner needs a score of at least 0.6 and a lead of 0.15.
|
|
58
|
+
*/
|
|
59
|
+
export async function classifyPrompt(agentDir, prompt, catalogs = {}) {
|
|
60
|
+
const catalog = await listSkillCatalog(agentDir);
|
|
61
|
+
const processing = catalog.filter((entry) => entry.kind === "processing");
|
|
62
|
+
const scored = [];
|
|
63
|
+
for (const entry of processing) {
|
|
64
|
+
const loaded = await loadSkill(agentDir, entry.key);
|
|
65
|
+
scored.push({ skill: entry.key, score: instructionScore(prompt, loaded.body), body: loaded.body });
|
|
66
|
+
}
|
|
67
|
+
scored.sort((a, b) => b.score - a.score || a.skill.localeCompare(b.skill));
|
|
68
|
+
const candidates = scored.map(({ skill, score }) => ({ skill, score }));
|
|
69
|
+
const top = scored[0];
|
|
70
|
+
const second = scored[1]?.score ?? 0;
|
|
71
|
+
if (!top || top.score < 0.6 || top.score - second < 0.15) {
|
|
72
|
+
return { status: top && top.score >= 0.6 ? "ambiguous" : "none", candidates };
|
|
73
|
+
}
|
|
74
|
+
const audit = catalog.find((entry) => entry.kind === "auditing" && entry.audits === top.skill);
|
|
75
|
+
return {
|
|
76
|
+
status: "match",
|
|
77
|
+
skill: top.skill,
|
|
78
|
+
confidence: top.score,
|
|
79
|
+
...(audit ? { auditSkill: audit.key } : {}),
|
|
80
|
+
steps: await stepsUsing(agentDir, top.skill),
|
|
81
|
+
promptVersion: instructionVersion(top.body, catalogs),
|
|
82
|
+
candidates,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=classify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../src/classify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAsB1D,MA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,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACxE,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC;QACzD,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;IAChF,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/F,OAAO;QACL,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,UAAU,EAAE,GAAG,CAAC,KAAK;QACrB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,KAAK,EAAE,MAAM,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC;QAC5C,aAAa,EAAE,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC;QACrD,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type AiDispatcher, type AiDispatcherOptions, type AiDispatcherRequest, type AiDispatcherResponse } from "@x12i/ai-dispatcher";
|
|
2
2
|
import type { MemorixClient } from "@x12i/memorix-client";
|
|
3
3
|
import { type MemorixSkillsMemorixOptions } from "./memorix.js";
|
|
4
|
+
/** The prompt `run` would send for this skill and these records. */
|
|
5
|
+
export declare function renderSkillPrompt(skillsDir: string, skill: string, records: Record<string, unknown>[], catalogs?: Record<string, unknown>): Promise<string>;
|
|
4
6
|
export declare class CodeSkillNotDispatchableError extends Error {
|
|
5
7
|
readonly code = "CODE_SKILL_NOT_DISPATCHABLE";
|
|
6
8
|
readonly skill: string;
|
|
@@ -33,12 +35,20 @@ export type RunSkillInput = {
|
|
|
33
35
|
*/
|
|
34
36
|
catalogs?: Record<string, unknown>;
|
|
35
37
|
};
|
|
38
|
+
export type RunInternalInput = {
|
|
39
|
+
action: string;
|
|
40
|
+
/** Slot values named by the action's `input` frontmatter. */
|
|
41
|
+
input: Record<string, unknown>;
|
|
42
|
+
request?: SkillDispatcherRequest;
|
|
43
|
+
};
|
|
36
44
|
export type MemorixSkills = {
|
|
37
45
|
readonly skillsDir: string;
|
|
38
46
|
readonly dispatcher: AiDispatcher;
|
|
39
47
|
/** Memorix HTTP client for callers; unused by `run`. */
|
|
40
48
|
readonly memorix: MemorixClient;
|
|
41
49
|
run(input: RunSkillInput): Promise<AiDispatcherResponse>;
|
|
50
|
+
/** Render `internal/{action}.md` and call the dispatcher. Not a sequence step. */
|
|
51
|
+
runInternal(input: RunInternalInput): Promise<AiDispatcherResponse>;
|
|
42
52
|
};
|
|
43
53
|
export declare function createMemorixSkills(options?: MemorixSkillsOptions): MemorixSkills;
|
|
44
54
|
//# sourceMappingURL=create-memorix-skills.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-memorix-skills.d.ts","sourceRoot":"","sources":["../src/create-memorix-skills.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAA6B,KAAK,2BAA2B,E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DAAmD;IACnD,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACzD,kFAAkF;IAClF,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACrE,CAAC;AAoCF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAsCrF"}
|
|
@@ -3,7 +3,16 @@ import { createAiDispatcher, } from "@x12i/ai-dispatcher";
|
|
|
3
3
|
import { render } from "@x12i/rendrix";
|
|
4
4
|
import { createSkillsMemorixClient } from "./memorix.js";
|
|
5
5
|
import { assertPromptCatalogs } from "./prompt-catalog.js";
|
|
6
|
+
import { loadInternalAction, renderInternalAction } from "./internal.js";
|
|
6
7
|
import { loadSkill } from "./skills.js";
|
|
8
|
+
/** The prompt `run` would send for this skill and these records. */
|
|
9
|
+
export async function renderSkillPrompt(skillsDir, skill, records, catalogs) {
|
|
10
|
+
const loaded = await loadSkill(skillsDir, skill);
|
|
11
|
+
if (loaded.metadata.kind === "code")
|
|
12
|
+
throw new CodeSkillNotDispatchableError(skill);
|
|
13
|
+
assertPromptCatalogs(loaded.body, catalogs);
|
|
14
|
+
return render(loaded.body, { job: {}, task: {}, input: records }, undefined, undefined, catalogs ? { catalogs } : undefined);
|
|
15
|
+
}
|
|
7
16
|
export class CodeSkillNotDispatchableError extends Error {
|
|
8
17
|
code = "CODE_SKILL_NOT_DISPATCHABLE";
|
|
9
18
|
skill;
|
|
@@ -62,6 +71,14 @@ export function createMemorixSkills(options = {}) {
|
|
|
62
71
|
prompt,
|
|
63
72
|
});
|
|
64
73
|
},
|
|
74
|
+
async runInternal({ action, input, request = {} }) {
|
|
75
|
+
const loaded = loadInternalAction(skillsDir, action);
|
|
76
|
+
const prompt = renderInternalAction(loaded, input);
|
|
77
|
+
return dispatcher.run({
|
|
78
|
+
...withSkillDefaults(request, loaded),
|
|
79
|
+
prompt,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
65
82
|
};
|
|
66
83
|
}
|
|
67
84
|
//# sourceMappingURL=create-memorix-skills.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-memorix-skills.js","sourceRoot":"","sources":["../src/create-memorix-skills.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,kBAAkB,GAKnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAoC,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAsB,MAAM,aAAa,CAAC;AAE5D,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAC7C,IAAI,GAAG,6BAA6B,CAAC;IACrC,KAAK,CAAS;IAEvB,YAAY,KAAa;QACvB,KAAK,CAAC,SAAS,KAAK,uDAAuD,CAAC,CAAC;QAC7E,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,KAAK,C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AW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE;YAC/C,MAAM,MAAM,GAAmB,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACrE,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACnD,OAAO,UAAU,CAAC,GAAG,CAAC;gBACpB,GAAG,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC;gBACrC,MAAM;aACP,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { assertPromptCatalogs, PromptCatalogError } from "./prompt-catalog.js";
|
|
2
|
-
export {
|
|
2
|
+
export { classifyPrompt, instructionScore, instructionVersion, type ClassifyCandidate, type ClassifyMatch, type ClassifyMiss, } from "./classify.js";
|
|
3
|
+
export { CodeSkillNotDispatchableError, createMemorixSkills, renderSkillPrompt, type AiDispatcherResponse, type MemorixSkills, type MemorixSkillsOptions, type RunInternalInput, type RunSkillInput, type SkillDispatcherRequest, } from "./create-memorix-skills.js";
|
|
3
4
|
export { createSkillsMemorixClient, type MemorixSkillsMemorixOptions, } from "./memorix.js";
|
|
5
|
+
export { InternalActionNotFoundError, listInternalActions, loadInternalAction, renderInternalAction, type InternalAction, } from "./internal.js";
|
|
4
6
|
export { DuplicateSkillKeyError, InvalidSkillKeyError, InvalidSkillMetadataError, SkillNotFoundError, agentSkillsDir, SKILL_KINDS, assertValidSkillKey, listSkillCatalog, listSkillKeys, loadSkill, loadSkillTemplate, parseSkillDocument, skillFilePath, type LoadedSkill, type SkillCatalogEntry, type SkillKind, type SkillMetadata, } from "./skills.js";
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,sBAAsB,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,EACzB,KAAK,2BAA2B,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,sBAAsB,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,EACzB,KAAK,2BAA2B,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { assertPromptCatalogs, PromptCatalogError } from "./prompt-catalog.js";
|
|
2
|
-
export {
|
|
2
|
+
export { classifyPrompt, instructionScore, instructionVersion, } from "./classify.js";
|
|
3
|
+
export { CodeSkillNotDispatchableError, createMemorixSkills, renderSkillPrompt, } from "./create-memorix-skills.js";
|
|
3
4
|
export { createSkillsMemorixClient, } from "./memorix.js";
|
|
5
|
+
export { InternalActionNotFoundError, listInternalActions, loadInternalAction, renderInternalAction, } from "./internal.js";
|
|
4
6
|
export { DuplicateSkillKeyError, InvalidSkillKeyError, InvalidSkillMetadataError, SkillNotFoundError, agentSkillsDir, SKILL_KINDS, assertValidSkillKey, listSkillCatalog, listSkillKeys, loadSkill, loadSkillTemplate, parseSkillDocument, skillFilePath, } from "./skills.js";
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,GAInB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,iBAAiB,GAOlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GAErB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,GAKd,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class InternalActionNotFoundError extends Error {
|
|
2
|
+
readonly code = "INTERNAL_ACTION_NOT_FOUND";
|
|
3
|
+
readonly action: string;
|
|
4
|
+
constructor(action: string, skillsDir: string);
|
|
5
|
+
}
|
|
6
|
+
export type InternalAction = {
|
|
7
|
+
key: string;
|
|
8
|
+
title: string;
|
|
9
|
+
/** Slot names the caller fills. The template sees them as `input`. */
|
|
10
|
+
input: string[];
|
|
11
|
+
body: string;
|
|
12
|
+
filePath: string;
|
|
13
|
+
provider?: string;
|
|
14
|
+
model?: string;
|
|
15
|
+
reasoningEffort?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function listInternalActions(skillsDir: string): InternalAction[];
|
|
18
|
+
export declare function loadInternalAction(skillsDir: string, key: string): InternalAction;
|
|
19
|
+
/** Render one action. Does not call a model. */
|
|
20
|
+
export declare function renderInternalAction(action: InternalAction, input: Record<string, unknown>): string;
|
|
21
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAaA,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,IAAI,+BAA+B;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAK9C;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAIF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,EAAE,CAKvE;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAKjF;AAED,gDAAgD;AAChD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQnG"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal helper actions. They are not sequence steps.
|
|
3
|
+
*
|
|
4
|
+
* Files live in `internal/` beside `processing/`, `auditing/`, and `code/`.
|
|
5
|
+
* The package ships a default set. A file in the agent folder with the same
|
|
6
|
+
* key replaces that default. Any other file in the agent folder is an added action.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
import { render } from "@x12i/rendrix";
|
|
12
|
+
import { assertValidSkillKey, InvalidSkillMetadataError } from "./skills.js";
|
|
13
|
+
export class InternalActionNotFoundError extends Error {
|
|
14
|
+
code = "INTERNAL_ACTION_NOT_FOUND";
|
|
15
|
+
action;
|
|
16
|
+
constructor(action, skillsDir) {
|
|
17
|
+
super(`No internal action "${action}" in ${skillsDir}/internal or the skill-runner internal folder`);
|
|
18
|
+
this.name = "InternalActionNotFoundError";
|
|
19
|
+
this.action = action;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const PACKAGE_INTERNAL = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../internal");
|
|
23
|
+
export function listInternalActions(skillsDir) {
|
|
24
|
+
const map = new Map();
|
|
25
|
+
for (const action of readFolder(PACKAGE_INTERNAL))
|
|
26
|
+
map.set(action.key, action);
|
|
27
|
+
for (const action of readFolder(path.join(path.resolve(skillsDir), "internal")))
|
|
28
|
+
map.set(action.key, action);
|
|
29
|
+
return [...map.values()].sort((a, b) => a.key.localeCompare(b.key));
|
|
30
|
+
}
|
|
31
|
+
export function loadInternalAction(skillsDir, key) {
|
|
32
|
+
assertValidSkillKey(key);
|
|
33
|
+
const found = listInternalActions(skillsDir).find((action) => action.key === key);
|
|
34
|
+
if (!found)
|
|
35
|
+
throw new InternalActionNotFoundError(key, skillsDir);
|
|
36
|
+
return found;
|
|
37
|
+
}
|
|
38
|
+
/** Render one action. Does not call a model. */
|
|
39
|
+
export function renderInternalAction(action, input) {
|
|
40
|
+
const missing = action.input.filter((slot) => input[slot] == null || input[slot] === "");
|
|
41
|
+
if (missing.length) {
|
|
42
|
+
throw new InvalidSkillMetadataError(action.key, `missing input: ${missing.join(", ")}`);
|
|
43
|
+
}
|
|
44
|
+
const slots = {};
|
|
45
|
+
for (const slot of action.input)
|
|
46
|
+
slots[slot] = input[slot];
|
|
47
|
+
return render(action.body, { job: {}, task: {}, input: slots });
|
|
48
|
+
}
|
|
49
|
+
function readFolder(dir) {
|
|
50
|
+
if (!existsSync(dir))
|
|
51
|
+
return [];
|
|
52
|
+
const found = [];
|
|
53
|
+
for (const name of readdirSync(dir)) {
|
|
54
|
+
if (!name.endsWith(".md"))
|
|
55
|
+
continue;
|
|
56
|
+
const key = name.slice(0, -3);
|
|
57
|
+
try {
|
|
58
|
+
assertValidSkillKey(key);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const filePath = path.join(dir, name);
|
|
64
|
+
found.push(parseAction(key, filePath, readFileSync(filePath, "utf8")));
|
|
65
|
+
}
|
|
66
|
+
return found;
|
|
67
|
+
}
|
|
68
|
+
function parseAction(key, filePath, raw) {
|
|
69
|
+
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?/);
|
|
70
|
+
const fields = match ? parseFields(match[1] ?? "", key) : {};
|
|
71
|
+
const body = (match ? raw.slice(match[0].length) : raw).trim();
|
|
72
|
+
const declared = fields.kind?.trim();
|
|
73
|
+
if (declared && declared !== "internal") {
|
|
74
|
+
throw new InvalidSkillMetadataError(key, `kind ${declared} does not match folder internal`);
|
|
75
|
+
}
|
|
76
|
+
const input = (fields.input ?? "")
|
|
77
|
+
.split(",")
|
|
78
|
+
.map((slot) => slot.trim())
|
|
79
|
+
.filter(Boolean);
|
|
80
|
+
if (!input.length)
|
|
81
|
+
throw new InvalidSkillMetadataError(key, "internal actions require input");
|
|
82
|
+
for (const slot of input) {
|
|
83
|
+
if (!/^[A-Za-z][A-Za-z0-9]*$/.test(slot)) {
|
|
84
|
+
throw new InvalidSkillMetadataError(key, `input slot "${slot}" is not a name`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (!body)
|
|
88
|
+
throw new InvalidSkillMetadataError(key, "internal actions require a body");
|
|
89
|
+
const action = {
|
|
90
|
+
key,
|
|
91
|
+
title: fields.title?.trim() || titleFrom(key),
|
|
92
|
+
input,
|
|
93
|
+
body,
|
|
94
|
+
filePath,
|
|
95
|
+
};
|
|
96
|
+
if (fields.provider?.trim())
|
|
97
|
+
action.provider = fields.provider.trim();
|
|
98
|
+
if (fields.model?.trim())
|
|
99
|
+
action.model = fields.model.trim();
|
|
100
|
+
if (fields.reasoningEffort?.trim())
|
|
101
|
+
action.reasoningEffort = fields.reasoningEffort.trim();
|
|
102
|
+
return action;
|
|
103
|
+
}
|
|
104
|
+
function parseFields(block, key) {
|
|
105
|
+
const fields = {};
|
|
106
|
+
for (const line of block.split(/\r?\n/)) {
|
|
107
|
+
const trimmed = line.trim();
|
|
108
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
109
|
+
continue;
|
|
110
|
+
const idx = trimmed.indexOf(":");
|
|
111
|
+
if (idx <= 0)
|
|
112
|
+
throw new InvalidSkillMetadataError(key, `frontmatter line is not key: value (${trimmed})`);
|
|
113
|
+
let value = trimmed.slice(idx + 1).trim();
|
|
114
|
+
if ((value.startsWith('"') && value.endsWith('"') && value.length >= 2) ||
|
|
115
|
+
(value.startsWith("'") && value.endsWith("'") && value.length >= 2)) {
|
|
116
|
+
value = value.slice(1, -1);
|
|
117
|
+
}
|
|
118
|
+
fields[trimmed.slice(0, idx).trim()] = value;
|
|
119
|
+
}
|
|
120
|
+
return fields;
|
|
121
|
+
}
|
|
122
|
+
function titleFrom(key) {
|
|
123
|
+
const words = key.replace(/[-_.]+/g, " ");
|
|
124
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,aAAa,C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
6
|
+
|
|
7
|
+
You are auditing a prompt before it runs. You do not answer the prompt. You do not rewrite a stored record.
|
|
8
|
+
|
|
9
|
+
Read the prompt in `{{input}}`. The object has `prompt`.
|
|
10
|
+
|
|
11
|
+
Fail or warn when any of these are true:
|
|
12
|
+
|
|
13
|
+
- The prompt asks for a fact the reader of the prompt cannot check.
|
|
14
|
+
- A closed vocabulary is used and not named.
|
|
15
|
+
- Instructions that produce an answer are mixed with instructions that judge a stored answer.
|
|
16
|
+
|
|
17
|
+
`pass` means none of those are present. `warn` means the prompt can run but a rule is thin. `fail` means a rule above was broken.
|
|
18
|
+
|
|
19
|
+
Respond in markdown only (no code fences), exactly these sections:
|
|
20
|
+
|
|
21
|
+
# verdict
|
|
22
|
+
pass | warn | fail
|
|
23
|
+
|
|
24
|
+
# summary
|
|
25
|
+
<one sentence>
|
|
26
|
+
|
|
27
|
+
# findings
|
|
28
|
+
- <one problem, or omit the bullets when the verdict is pass>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Audit result
|
|
4
|
+
input: prompt, result
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are auditing a result against the prompt that produced it. You do not rewrite the result. You do not replace the prompt.
|
|
8
|
+
|
|
9
|
+
Read `{{input}}`. The object has `prompt` and `result`. Judge `result` only against that `prompt`.
|
|
10
|
+
|
|
11
|
+
Fail or warn when any of these are true:
|
|
12
|
+
|
|
13
|
+
- The result asserts something the prompt does not allow.
|
|
14
|
+
- A required section or field from the prompt is missing.
|
|
15
|
+
- The result answers a different job than the prompt asked for.
|
|
16
|
+
|
|
17
|
+
`pass` means the result follows the prompt. `warn` means it is usable and a part is thin. `fail` means it breaks the prompt.
|
|
18
|
+
|
|
19
|
+
Respond in markdown only (no code fences), exactly these sections:
|
|
20
|
+
|
|
21
|
+
# verdict
|
|
22
|
+
pass | warn | fail
|
|
23
|
+
|
|
24
|
+
# summary
|
|
25
|
+
<one sentence>
|
|
26
|
+
|
|
27
|
+
# findings
|
|
28
|
+
- <one broken rule, or omit the bullets when the verdict is pass>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Fix attempt
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You prepare the next attempt. You do not edit the skill file. Read `{{input}}`. It has the cause class and the account.
|
|
8
|
+
|
|
9
|
+
`addendum` is text the next execution must follow. When the class is `instructions`, `proposal` is a suggested change to the skill text the client may apply. Otherwise omit the proposal section.
|
|
10
|
+
|
|
11
|
+
Respond in markdown only:
|
|
12
|
+
|
|
13
|
+
# addendum
|
|
14
|
+
<what the next attempt must change>
|
|
15
|
+
|
|
16
|
+
# proposal
|
|
17
|
+
<instruction change, or leave this section empty>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Improve prompt
|
|
4
|
+
input: prompt
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are improving a prompt. You do not run it. You do not invent a new job.
|
|
8
|
+
|
|
9
|
+
Read the prompt in `{{input}}`. The object has `prompt`. Return a replacement that keeps the same job, names any closed vocabulary the original relies on, and separates producing an answer from judging a stored answer.
|
|
10
|
+
|
|
11
|
+
Respond in markdown only (no code fences), exactly these sections:
|
|
12
|
+
|
|
13
|
+
# summary
|
|
14
|
+
<one sentence on what changed>
|
|
15
|
+
|
|
16
|
+
# prompt
|
|
17
|
+
<the full replacement prompt>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate audit
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You investigate one failed result. You do not rewrite it. Read `{{input}}`.
|
|
8
|
+
|
|
9
|
+
Judge only the basic audit. A finding the response does not support is a fault in the audit. Write a short note.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate context
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You investigate one failed result. You do not rewrite it. Read `{{input}}`.
|
|
8
|
+
|
|
9
|
+
Judge only the context and catalogs the prompt named. Say when expected knowledge was absent or wrong. Write a short note.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate contract
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You investigate one failed result. You do not rewrite it. Read `{{input}}`.
|
|
8
|
+
|
|
9
|
+
Judge only the output shape against the contract: missing fields, extra stamps, or a value outside the allowed vocabulary. Write a short note.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate execution
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You investigate one failed result. You do not rewrite it. Read `{{input}}`.
|
|
8
|
+
|
|
9
|
+
Judge only the execution settings in the packet: model, reasoning effort, truncation, or token limit. Say whether a stronger model or a higher reasoning effort would be required. Write a short note.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate inputs
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You investigate one failed result. You do not rewrite it. Read `{{input}}`.
|
|
8
|
+
|
|
9
|
+
Judge only the inputs: a missing source ref, a wrong revision, or records that contradict the answer. Write a short note.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate instructions
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You investigate one failed result. You do not rewrite it. Read `{{input}}`.
|
|
8
|
+
|
|
9
|
+
Judge only the instructions: a gap, a contradiction, or a conflict with the output contract. Do not blame the model unless the instructions themselves cannot be followed. Write a short note.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate provenance
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You investigate one failed result. You do not rewrite it. Read `{{input}}`.
|
|
8
|
+
|
|
9
|
+
Judge only provenance: the step, the skill, or the prompt version disagree with the request, or the source refs do not belong to the subject. Write a short note.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate response
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You investigate one failed result. You do not rewrite it. Read `{{input}}`. The packet has the response, the basic findings, and the execution settings.
|
|
8
|
+
|
|
9
|
+
Judge only whether the response follows the skill instructions it was given. Name the broken rule when one is visible. Do not decide the root cause class. Write a short note.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: internal
|
|
3
|
+
title: Investigate synthesis
|
|
4
|
+
input: packet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You read eight investigation notes in `{{input}}`. You do not add a ninth investigation. You choose one class for the failure.
|
|
8
|
+
|
|
9
|
+
The class is one of: instructions, execution, inputs, context, audit, contract, provenance, none.
|
|
10
|
+
|
|
11
|
+
`none` means the notes do not support a cause.
|
|
12
|
+
|
|
13
|
+
Respond in markdown only, exactly these sections:
|
|
14
|
+
|
|
15
|
+
# class
|
|
16
|
+
<one class word>
|
|
17
|
+
|
|
18
|
+
# account
|
|
19
|
+
<one sentence naming the notes you used>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x12i/memorix-skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Skill runner — load an agent processing and auditing *.md, render with Rendrix, run via @x12i/ai-dispatcher",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
+
"internal",
|
|
16
17
|
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"publishConfig": {
|