Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ jobs:
- name: Test version-bump enforcement
run: node --test scripts/check-versions.test.mjs
- name: Install released product packages for tests
run: npm install --no-save --no-package-lock --ignore-scripts @0xbuff/[email protected] @0xbuff/[email protected].1 @0xbuff/[email protected]
run: npm install --no-save --no-package-lock --ignore-scripts @0xbuff/[email protected] @0xbuff/[email protected].2 @0xbuff/preceptor@0.0.2 @0xbuff/retention@0.0.2
- name: Test example diagrams
run: node scripts/smoke-throughline.mjs
- name: Test Assay examples and contract boundaries
run: node scripts/smoke-assay.mjs
- name: Test Preceptor examples and contract boundaries
run: node scripts/smoke-preceptor.mjs
- name: Test Retention examples and contract boundaries
run: node scripts/smoke-retention.mjs
- name: Check skills CLI
run: npx --yes skills add . --list
- name: Verify Claude Code and Codex installation for all skills
Expand Down
11 changes: 9 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Do not add empty optional directories, shared runtime dependencies, or cross-ski

## Assay contract

- Assay targets `@0xbuff/[email protected].1`, schema 4, evaluator semantics v0.0.5 and composed-required-v1.
- Assay targets `@0xbuff/[email protected].2`, schema 4, evaluator semantics v0.0.5 and composed-required-v1.
- Keep all runnable examples synthetic and preserve host-owned authorization, execution, evidence authenticity and disclosure. Never equate technical evaluation with formal grading.
- Update `evals/assay.json` and `scripts/smoke-assay.mjs` when changing observable guidance. Keep the documented package version independent from the skill version.

Expand All @@ -58,6 +58,12 @@ Do not add empty optional directories, shared runtime dependencies, or cross-ski
- Preserve host-owned authority, assessment locks, bounded dispatch, scoped memory and committed-summary separation. Do not imply advisory output confers credit.
- Keep fixtures synthetic, and update `evals/preceptor.json` and `scripts/smoke-preceptor.mjs` when changing observable guidance.

## Retention contract

- Retention targets `@0xbuff/[email protected]`, schema 1 and algorithm version `"1"`.
- Keep practice scheduling separate from independently admitted credited evidence and candidate readiness. The host owns evidence admission, history, authorization, delivery and physical erasure.
- Keep examples synthetic and update `evals/retention.json` and `scripts/smoke-retention.mjs` when changing observable guidance.

## Verification

Run from the repository root:
Expand All @@ -66,10 +72,11 @@ Run from the repository root:
node scripts/check-skill.mjs
node --test scripts/check-skill.test.mjs scripts/check-versions.test.mjs
node scripts/check-versions.mjs
npm install --no-save --no-package-lock --ignore-scripts @0xbuff/[email protected] @0xbuff/[email protected].1 @0xbuff/[email protected]
npm install --no-save --no-package-lock --ignore-scripts @0xbuff/[email protected] @0xbuff/[email protected].2 @0xbuff/preceptor@0.0.2 @0xbuff/retention@0.0.2
node scripts/smoke-throughline.mjs
node scripts/smoke-assay.mjs
node scripts/smoke-preceptor.mjs
node scripts/smoke-retention.mjs
npx --yes skills add . --list
```

Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ A collection of self-contained [Agent Skills](https://agentskills.io) for buildi
| --- | --- | --- |
| [Assay](skills/assay/SKILL.md) | Define, evaluate, validate, and integrate technical assessments. | `npx skills add https://github.com/0xbuffdev/skills --skill assay` |
| [Preceptor](skills/preceptor/SKILL.md) | Plan instruction and integrate scoped model assistance, memory and committed summaries. | `npx skills add https://github.com/0xbuffdev/skills --skill preceptor` |
| [Retention](skills/retention/SKILL.md) | Schedule reviews, reconcile learning history and evaluate advisory candidate readiness. | `npx skills add https://github.com/0xbuffdev/skills --skill retention` |
| [Throughline](skills/throughline/SKILL.md) | Author, compile, validate, and embed step-by-step Throughline visualizations. | `npx skills add https://github.com/0xbuffdev/skills --skill throughline` |

### Assay
Expand All @@ -26,7 +27,7 @@ Install the runtime separately in the consuming project:
npm install @0xbuff/assay
```

The skill targets `@0xbuff/[email protected].1` (Node.js 24+ ESM, schema 4). Its local references and runnable examples cover evaluation, observation acquisition, protected expectations and public projection. See [the skill](skills/assay/SKILL.md) and [Assay documentation](https://docs.0xbuff.com/docs/assay).
The skill targets `@0xbuff/[email protected].2` (Node.js 24+ ESM, schema 4). Its local references and runnable examples cover evaluation, observation acquisition, protected expectations and public projection. See [the skill](skills/assay/SKILL.md) and [Assay documentation](https://docs.0xbuff.com/docs/assay).

### Preceptor

Expand All @@ -44,6 +45,24 @@ npm install @0xbuff/preceptor

The skill targets `@0xbuff/[email protected]` (Node.js 24+ ESM). Its references and examples cover model-free planning, scoped ports, narrative memory and committed host feedback. See [the skill](skills/preceptor/SKILL.md) and [Preceptor documentation](https://docs.0xbuff.com/docs/preceptor).

### Retention

Retention calculates review dates and ranks due concepts from learning observations. It can also evaluate candidate readiness from independently admitted credited evidence.

Install the skill:

```sh
npx skills add https://github.com/0xbuffdev/skills --skill retention
```

Install the runtime in the consuming project:

```sh
npm install @0xbuff/retention
```

The skill targets `@0xbuff/[email protected]` (Node.js 24+ ESM; compatible ES2022 browser builds). Its references and examples cover policies, event replay, due ranking and advisory readiness. See [the skill](skills/retention/SKILL.md) and [Retention documentation](https://docs.0xbuff.com/docs/retention).

### Throughline

Install the skill for your coding agent:
Expand Down Expand Up @@ -75,6 +94,10 @@ The skill targets `@0xbuff/[email protected]`; the interactive player additional
│ │ ├── SKILL.md
│ │ ├── references/
│ │ └── assets/
│ ├── retention/
│ │ ├── SKILL.md
│ │ ├── references/
│ │ └── assets/
│ └── throughline/
│ ├── SKILL.md # Required skill entry point
│ ├── references/ # Detailed usage guides, read as needed
Expand Down
7 changes: 7 additions & 0 deletions evals/assay.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@
"expected_output": "Does not activate Assay unless technical assessment is also requested; use Throughline skill.",
"files": [],
"should_trigger": false
},
{
"id": 13,
"prompt": "My project already pins Assay 0.0.1. Use the skill to add an evaluation without changing dependencies.",
"expected_output": "Checks the installed version and lockfile; verifies the older contract or asks before changing dependencies; does not silently upgrade to 0.0.2.",
"files": [],
"should_trigger": true
}
]
}
7 changes: 7 additions & 0 deletions evals/preceptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@
"expected_output": "Does not select the Preceptor software skill.",
"files": [],
"should_trigger": false
},
{
"id": 13,
"prompt": "Connect Preceptor memory recall. The model omits limit; can my adapter assume query.limit and query.maxFactBytes are present?",
"expected_output": "Distinguishes optional model request limit from required bounded adapter query limit and maxFactBytes; binds adapter to authorized scope.",
"files": [],
"should_trigger": true
}
]
}
89 changes: 89 additions & 0 deletions evals/retention.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"skill_name": "retention",
"evals": [
{
"id": 1,
"prompt": "Use Retention to calculate the first due review for a binary search concept after a practice pass.",
"expected_output": "Uses root exports, versioned policy, explicit clock and scoped event, checks ok, returns due queue only at or after due time.",
"files": [],
"should_trigger": true
},
{
"id": 2,
"prompt": "Build spaced review scheduling in my learning app using @0xbuff/retention. An early pass should advance the interval.",
"expected_output": "Preserves early pass stage and due time; due pass advances; tests retry and support rules.",
"files": [],
"should_trigger": true
},
{
"id": 3,
"prompt": "Implement Retention local calendar reviews across a daylight-saving transition.",
"expected_output": "Uses caller-provided calendarProfile with coverage and sorted transitions; distinguishes elapsed and civil days; tests gap/fold and insufficient coverage.",
"files": [],
"should_trigger": true
},
{
"id": 4,
"prompt": "I want to pass only the latest Retention event to advanceReview, without the prior history.",
"expected_output": "Requires exact prior identity and complete prior history; explicit rebuild if incompatible; no partial state.",
"files": [],
"should_trigger": true
},
{
"id": 5,
"prompt": "Use Retention to revoke a credited decision, correct a prior one and delete an event that has not arrived.",
"expected_output": "Preserves durable sequence, exact successor versions, original effective time, tombstone and full replay; no physical erasure claim.",
"files": [],
"should_trigger": true
},
{
"id": 6,
"prompt": "A practice pass has fresh=true, hints=0 and ladder=3. Count it as a qualifying credited success.",
"expected_output": "Keeps practice scheduling separate; only independently admitted credited evidence qualifies; no automatic credit.",
"files": [],
"should_trigger": true
},
{
"id": 7,
"prompt": "I have two qualifying Retention passes in the same session. Make candidate_ready by waiting a day.",
"expected_output": "Checks distinct session and actual first/last qualifying span; waiting alone cannot satisfy thresholds; candidate advisory.",
"files": [],
"should_trigger": true
},
{
"id": 8,
"prompt": "Rank Retention due items by overdue time, support and prerequisite relations. Skip validation when limit is zero.",
"expected_output": "Uses same policy scope clock; validates relations even at zero limit; deterministic score and ties; prerequisites do not block review.",
"files": [],
"should_trigger": true
},
{
"id": 9,
"prompt": "Can I log the Retention watermark as a harmless hash and trust it as authentication?",
"expected_output": "Explains canonical history JSON contains event data; protect it and authenticate independently.",
"files": [],
"should_trigger": true
},
{
"id": 10,
"prompt": "My Retention review was computed yesterday, but I want to use it for today's due queue.",
"expected_output": "Rebuilds at explicit current clock; checks failures and stale generation; no fabricated implicit time.",
"files": [],
"should_trigger": true
},
{
"id": 11,
"prompt": "Write a marketing customer retention campaign for a SaaS product.",
"expected_output": "Does not activate the learning review scheduling skill.",
"files": [],
"should_trigger": false
},
{
"id": 12,
"prompt": "Use Preceptor to choose a tutoring prompt and retrieve a lesson.",
"expected_output": "Does not activate Retention unless review scheduling is also requested.",
"files": [],
"should_trigger": false
}
]
}
2 changes: 2 additions & 0 deletions scripts/smoke-assay.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
} from "@0xbuff/assay";

const root = fileURLToPath(new URL("../", import.meta.url));
const manifest = JSON.parse(readFileSync(new URL("../node_modules/@0xbuff/assay/package.json", import.meta.url), "utf8"));
assert.equal(manifest.version, "0.0.2", "Use the package release targeted by this skill");
const skill = new URL("../skills/assay/", import.meta.url);
const source = readFileSync(new URL("SKILL.md", skill), "utf8");
const example = source.match(/^\x60{3}js\n([\s\S]*?)^\x60{3}$/m)?.[1];
Expand Down
20 changes: 20 additions & 0 deletions scripts/smoke-preceptor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as preceptor from "@0xbuff/preceptor";
const { planInstruction, runInstruction, projectCommittedSummary,
POLICY_REVISION, SUMMARY_SCHEMA_VERSION, SESSION_LIMITS } = preceptor;
const root = fileURLToPath(new URL("../", import.meta.url));
const manifest = JSON.parse(readFileSync(new URL("../node_modules/@0xbuff/preceptor/package.json", import.meta.url), "utf8"));
assert.equal(manifest.version, "0.0.2", "Use the package release targeted by this skill");
const skill = new URL("../skills/preceptor/", import.meta.url);
const source = readFileSync(new URL("SKILL.md", skill), "utf8");
const example = source.match(/^\x60{3}js\n([\s\S]*?)^\x60{3}$/m)?.[1];
Expand Down Expand Up @@ -83,6 +85,24 @@ const mismatch = await runInstruction(scoped, { assistance: "generate", text: "H
assert.equal(mismatch.status, "incomplete_context");
assert.equal(mismatch.toolOutcomes[0].reason, "source_mismatch");

const recallHost = { ...host, grants: ["memory.recall"], consent: ["memory.recall"], installed: ["memory.recall"] };
let recallCalls = 0;
const recalled = await runInstruction(recallHost, { assistance: "generate", text: "Help" }, {
model: { ...attribution, async generate(input) {
if (!input.context.toolResults.length) return { kind: "tools", attribution,
requests: [{ callId: "recall-1", operation: "memory.recall", arguments: {} }] };
return { kind: "final", attribution, text: "Try an example." };
} },
memory: { async recall(query) {
recallCalls++;
assert.ok(Number.isSafeInteger(query.limit) && query.limit >= 0);
assert.ok(Number.isSafeInteger(query.maxFactBytes) && query.maxFactBytes >= 0);
return { kind: "facts", facts: [], completeness: "complete" };
} },
});
assert.equal(recalled.status, "completed");
assert.equal(recallCalls, 1);

const defence = planInstruction({ ...scoped, mode: "defense_preparation" }, { assistance: "plan" });
assert.equal(defence.status, "completed");
assert.equal(defence.capabilities.includes("lesson.read"), false);
Expand Down
78 changes: 78 additions & 0 deletions scripts/smoke-retention.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import * as retention from "@0xbuff/retention";

const root = fileURLToPath(new URL("../", import.meta.url));
const manifest = JSON.parse(readFileSync(new URL("../node_modules/@0xbuff/retention/package.json", import.meta.url), "utf8"));
assert.equal(manifest.version, "0.0.2", "Use the package release targeted by this skill");
const skill = new URL("../skills/retention/", import.meta.url);
const source = readFileSync(new URL("SKILL.md", skill), "utf8");
const example = source.match(/^\x60{3}js\n([\s\S]*?)^\x60{3}$/m)?.[1];
assert.ok(example, "Missing inline minimal example");
const run = (args, input) => execFileSync(process.execPath, args, {
cwd: root, input, encoding: "utf8", timeout: 10_000,
}).trim();
assert.equal(run(["--input-type=module"], example), "binary-search 86400000 ordinary");
for (const [file, output] of [
["scheduling.mjs", "86400000 345600000"],
["replay.mjs", "1 DUE_PASS"],
["readiness.mjs", "developing 1 candidate_ready 2"],
["priority.mjs", "binary-search:5 sorting:0"],
]) assert.equal(run([fileURLToPath(new URL("assets/" + file, skill))]), output, file);

const { validatePolicy, validateEvents, rebuildReview, advanceReview, evaluateReadiness, scheduleDue, explainReview } = retention;
const api = readFileSync(new URL("references/api.md", skill), "utf8");
for (const name of Object.keys(retention)) assert.match(api, new RegExp("\\b" + name + "\\b"));
const day = 86_400_000;
const policy = { schemaVersion: 1, algorithmVersion: "1", policyId: "deck", policyVersion: "v1",
scheduling: { intervalsDays: [1, 3, 7], retryDays: 1, maintenanceDays: 30,
supportAfterMisses: 2, longProbeAction: "restart", dateArithmetic: "elapsed_milliseconds" } };
const event = { schemaVersion: 1, kind: "practice_observation", scopeId: "deck", conceptId: "binary-search",
eventId: "review-1", sequence: 0, atMs: 0, sessionId: "session-1", outcome: "pass" };
function unwrap(result) { assert.equal(result.ok, true, JSON.stringify(result)); return result.value; }
function fails(result) { assert.equal(result.ok, false); assert.ok(result.errors.length); }
unwrap(validatePolicy(policy));
fails(validatePolicy({ ...policy, scheduling: { ...policy.scheduling, intervalsDays: [0] } }));
assert.equal(unwrap(validateEvents("deck", [event, { ...event }])).length, 1);
fails(validateEvents("deck", [event, { ...event, outcome: "fail" }]));
fails(validateEvents("other", [event]));
const initial = unwrap(rebuildReview(policy, "deck", [event], day - 1));
assert.equal(unwrap(scheduleDue(policy, "deck", initial, day - 1)).length, 0);
fails(scheduleDue(policy, "deck", initial, day));
const due = unwrap(rebuildReview(policy, "deck", [event], day));
assert.equal(unwrap(scheduleDue(policy, "deck", due, day))[0].conceptId, "binary-search");
assert.equal(unwrap(scheduleDue(policy, "deck", due, day, [], 0)).length, 0);
fails(scheduleDue(policy, "deck", due, day, [{ kind: "prerequisite", fromConceptId: "binary-search", toConceptId: "binary-search" }], 0));
const appended = [{ ...event, eventId: "review-2", sequence: 1, atMs: day }];
const next = unwrap(advanceReview(policy, "deck", due.identity, [event], appended, day));
assert.deepEqual(next, unwrap(rebuildReview(policy, "deck", [event, ...appended], day)));
fails(advanceReview(policy, "deck", due.identity, [], appended, day));
assert.equal(unwrap(explainReview(next)).concepts[0].practiceReasons.at(-1).code, "DUE_PASS");
const deletion = { schemaVersion: 1, kind: "review_event_deletion", scopeId: "deck", conceptId: "binary-search",
eventId: "delete-1", sequence: 1, atMs: day, targetEventId: event.eventId };
const removed = unwrap(rebuildReview(policy, "deck", [event, deletion], day));
assert.equal(removed.appliedEventIds.length, 0);
assert.equal(removed.concepts[0].scheduleState, "unobserved");
const eligible = { ...policy, eligibility: { eligibilityPolicyVersion: "v1", minSuccesses: 1, minSessions: 1,
minSpanMs: 0, requireFresh: true, maxHints: 0, minLadder: 3, onFailure: "reset", onNonqualifying: "ignore" } };
const practice = { ...event, fresh: true, hints: 0, ladder: 3 };
const candidate = unwrap(evaluateReadiness(eligible, "deck", "binary-search", [practice], day));
assert.equal(candidate.readiness, "unknown");
assert.equal(candidate.qualifyingSuccesses, 0);
const credit = { ...practice, kind: "eligible_credited_retrieval", eventId: "credit-1", sequence: 1,
creditDecisionId: "decision-1", decisionVersion: 1, eligibilityPolicyVersion: "v1" };
assert.equal(unwrap(evaluateReadiness(eligible, "deck", "binary-search", [practice, credit], day)).readiness, "candidate_ready");
const correction = { schemaVersion: 1, kind: "credited_decision_correction", scopeId: "deck", conceptId: "binary-search",
eventId: "correct-1", sequence: 2, atMs: day, supersedesDecisionId: credit.creditDecisionId,
replacementDecisionId: "decision-2", decisionVersion: 2, reasonCode: "fixture",
replacement: { sessionId: credit.sessionId, outcome: "fail", fresh: true, hints: 0, ladder: 3, eligibilityPolicyVersion: "v1" } };
const corrected = unwrap(evaluateReadiness(eligible, "deck", "binary-search", [practice, credit, correction], day));
assert.equal(corrected.readiness, "developing");
assert.equal(corrected.qualifyingSuccesses, 0);
const revoke = { schemaVersion: 1, kind: "credited_decision_revocation", scopeId: "deck", conceptId: "binary-search",
eventId: "revoke-1", sequence: 2, atMs: day, supersedesDecisionId: credit.creditDecisionId, reasonCode: "fixture" };
assert.equal(unwrap(evaluateReadiness(eligible, "deck", "binary-search", [practice, credit, revoke], day)).readiness, "unknown");
assert.equal(unwrap(evaluateReadiness(policy, "deck", "binary-search", [practice], day)), null);
console.log("Retention examples, exports, policy, identity, replay, ranking, deletion and eligibility checks passed.");
Loading
Loading