@zelari/core 1.14.3 → 1.15.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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schemaLoop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaLoop.d.ts","sourceRoot":"","sources":["../../../../src/agents/skills/builtin/schemaLoop.ts"],"names":[],"mappings":""}
@@ -0,0 +1,86 @@
1
+ import { registerCodingSkill } from '../../skills.js';
2
+ const schemaLoop = {
3
+ id: 'schema-loop',
4
+ version: '1.0.0',
5
+ name: 'Schema Loop (certify before done)',
6
+ description: 'Physicist-style coding harness: keep an explicit hypothesis, define certifiable checks, ' +
7
+ 'run_backtest before claiming done, and treat prediction mismatches as plan-voiding surprises. ' +
8
+ 'When ≥2 hypotheses remain, run one discriminating experiment first.',
9
+ category: 'debug',
10
+ requiredRoles: [],
11
+ requiredTools: [
12
+ 'update_world_hypothesis',
13
+ 'set_world_checks',
14
+ 'run_backtest',
15
+ 'record_world_observation',
16
+ 'bash',
17
+ 'read_file',
18
+ ],
19
+ estimatedCost: 'medium',
20
+ enabledByDefault: true,
21
+ builtin: true,
22
+ triggers: [
23
+ 'Non-trivial bug or multi-step implementation',
24
+ 'You are about to claim the task is done',
25
+ 'Tests or typecheck failed after edits',
26
+ 'Two or more competing root-cause hypotheses',
27
+ 'Surprising tool result (wrong exit code, missing path, shell mismatch)',
28
+ ],
29
+ antiPatterns: [
30
+ 'Trivial one-line typo fix with no uncertainty',
31
+ 'Pure documentation rewrite with no behavior change',
32
+ 'User explicitly asked for a draft-only answer without running tools',
33
+ ],
34
+ requires: [],
35
+ relatedSkills: ['debug-with-rag', 'root-cause-five-whys', 'reproduce-bug'],
36
+ tags: ['schema', 'backtest', 'hypothesis', 'verify', 'world-model', 'debug'],
37
+ examples: [
38
+ {
39
+ input: 'Fix the flaky headless test timeout',
40
+ output: {
41
+ hypothesis: 'Test hangs because registerMcpTools spawns real MCP servers; default 5s timeout is too low.',
42
+ checks: [
43
+ { id: 'unit', command: 'npx vitest run tests/unit/cli-useChatTurn.test.ts' },
44
+ ],
45
+ next: 'set_world_checks → implement isolation → run_backtest → only then claim done',
46
+ },
47
+ },
48
+ ],
49
+ outputSchema: '{ hypothesis: string; checks: Array<{ id: string; command: string }>; backtestOk: boolean; surprises?: string[] }',
50
+ systemPromptFragment: `You are running the **Schema Loop** adapted for software engineering
51
+ (inspired by Schema harness / ARC world-models — but for repos, not grids).
52
+
53
+ ## Core idea
54
+ The latent model of the task is **explicit files under .zelari/world/**, not only chat context:
55
+ - hypothesis.md — what you believe (objects = modules, mechanism = bug cause / design)
56
+ - checks.json — certifiable shell checks (the "reality" oracle)
57
+ - timeline.jsonl — append-only observations (do not rewrite history)
58
+
59
+ ## Outer loop
60
+ 1. **observe** — read errors, failing tests, tool results
61
+ 2. **deliberate** — update_world_hypothesis; set_world_checks
62
+ 3. **execute** — edit/run tools to change the repo
63
+ 4. **record** — record_world_observation on surprises; run_backtest to certify
64
+
65
+ ## Hard rules (reality outranks the model)
66
+ 1. **Never claim done** while the latest run_backtest has ok=false or total=0 without checks.
67
+ 2. After any batch of write/edit, prefer run_backtest (or set checks then backtest) before asserting success.
68
+ 3. **Surprise = void plan**: if a command exits unexpectedly, shell rejects POSIX on Windows, path missing, or tests fail differently than predicted — call record_world_observation (kind=surprise), revise hypothesis, do not keep patching blindly.
69
+ 4. **Discovery actions**: when ≥2 hypotheses remain consistent with evidence, design ONE discriminating experiment (read/grep/test) whose outcomes diverge; do not spray random edits.
70
+ 5. Prefer fast checks (single-file vitest, typecheck) over full suite until the model is stable.
71
+
72
+ ## Predict-then-act (soft)
73
+ Before a risky bash/edit, state a short prediction in hypothesis or observation
74
+ (expect exit 0, files touched). After the tool, if reality mismatches, log surprise.
75
+
76
+ ## Tools
77
+ - update_world_hypothesis — write/append theory
78
+ - set_world_checks — define certifiable commands
79
+ - run_backtest — replay all checks; report exact pass/fail
80
+ - record_world_observation — timeline ground truth
81
+
82
+ Kill switch for tools: ZELARI_SCHEMA_LOOP=0.
83
+ ${''}`,
84
+ };
85
+ registerCodingSkill(schemaLoop);
86
+ //# sourceMappingURL=schemaLoop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaLoop.js","sourceRoot":"","sources":["../../../../src/agents/skills/builtin/schemaLoop.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,UAAU,GAA0B;IACxC,EAAE,EAAE,aAAa;IACjB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,mCAAmC;IACzC,WAAW,EACT,0FAA0F;QAC1F,gGAAgG;QAChG,qEAAqE;IACvE,QAAQ,EAAE,OAAO;IACjB,aAAa,EAAE,EAAE;IACjB,aAAa,EAAE;QACb,yBAAyB;QACzB,kBAAkB;QAClB,cAAc;QACd,0BAA0B;QAC1B,MAAM;QACN,WAAW;KACZ;IACD,aAAa,EAAE,QAAQ;IACvB,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE;QACR,8CAA8C;QAC9C,yCAAyC;QACzC,uCAAuC;QACvC,6CAA6C;QAC7C,wEAAwE;KACzE;IACD,YAAY,EAAE;QACZ,+CAA+C;QAC/C,oDAAoD;QACpD,qEAAqE;KACtE;IACD,QAAQ,EAAE,EAAE;IACZ,aAAa,EAAE,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,eAAe,CAAC;IAC1E,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC;IAC5E,QAAQ,EAAE;QACR;YACE,KAAK,EAAE,qCAAqC;YAC5C,MAAM,EAAE;gBACN,UAAU,EACR,6FAA6F;gBAC/F,MAAM,EAAE;oBACN,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,mDAAmD,EAAE;iBAC7E;gBACD,IAAI,EAAE,8EAA8E;aACrF;SACF;KACF;IACD,YAAY,EACV,mHAAmH;IACrH,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCtB,EAAE,EAAE;CACL,CAAC;AAEF,mBAAmB,CAAC,UAAU,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zelari/core",
3
- "version": "1.14.3",
3
+ "version": "1.15.0",
4
4
  "description": "Zelari Code core library — provider-neutral agent loop (AgentHarness), multi-agent council orchestration, and built-in skills. Used by the zelari-code CLI; consumable by other agent frontends.",
5
5
  "author": "Anathema Studio <https://anathema-studio.com/>",
6
6
  "license": "MIT",
@@ -96,6 +96,10 @@
96
96
  "types": "./dist/agents/skills/builtin/testing.d.ts",
97
97
  "default": "./dist/agents/skills/builtin/testing.js"
98
98
  },
99
+ "./skills/builtin/schema-loop": {
100
+ "types": "./dist/agents/skills/builtin/schemaLoop.d.ts",
101
+ "default": "./dist/agents/skills/builtin/schemaLoop.js"
102
+ },
99
103
  "./events": {
100
104
  "types": "./dist/events/index.d.ts",
101
105
  "default": "./dist/events/index.js"