@oneie/claude 0.6.0 → 0.7.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.
Files changed (111) hide show
  1. package/agents/w1-recon.md +9 -4
  2. package/agents/w2-decide.md +51 -28
  3. package/agents/w3-edit.md +70 -78
  4. package/agents/w4-verify.md +164 -69
  5. package/commands/browser.md +98 -35
  6. package/commands/cc-connect.md +6 -0
  7. package/commands/chat.md +13 -1
  8. package/commands/close.md +45 -19
  9. package/commands/create.md +20 -10
  10. package/commands/db-sync.md +5 -1
  11. package/commands/deploy.md +174 -87
  12. package/commands/do-autonomous.md +31 -20
  13. package/commands/do-improve.md +4 -4
  14. package/commands/do-show.md +4 -3
  15. package/commands/do.md +53 -13
  16. package/commands/go.md +75 -0
  17. package/commands/improve.md +4 -2
  18. package/commands/kill.md +6 -8
  19. package/commands/notify.md +15 -2
  20. package/commands/oo-push.md +24 -9
  21. package/commands/rag.md +6 -0
  22. package/commands/release.md +46 -25
  23. package/commands/restart.md +5 -4
  24. package/commands/see.md +45 -35
  25. package/commands/skill-create.md +38 -5
  26. package/commands/sync.md +21 -11
  27. package/hooks/scripts/auto-continue.sh +70 -0
  28. package/hooks/scripts/branch-pin.sh +85 -0
  29. package/hooks/scripts/git-add-guard.sh +16 -5
  30. package/hooks/scripts/post-edit-check.sh +16 -0
  31. package/hooks/scripts/session-start.sh +13 -8
  32. package/hooks/scripts/sync-priority-todo.sh +5 -0
  33. package/package.json +1 -1
  34. package/rules/api.md +9 -0
  35. package/rules/design.md +13 -3
  36. package/rules/documentation.md +30 -71
  37. package/rules/engine.md +8 -1
  38. package/rules/ui.md +5 -1
  39. package/scripts/__pycache__/do-rank.cpython-313.pyc +0 -0
  40. package/scripts/browser-check.mjs +44 -103
  41. package/scripts/cc-events-proof.sh +13 -12
  42. package/scripts/chrome.mjs +381 -0
  43. package/scripts/do-analyze.sh +109 -4
  44. package/scripts/do-auto.sh +350 -43
  45. package/scripts/do-consumer-sweep.sh +72 -0
  46. package/scripts/do-derives-check.sh +88 -0
  47. package/scripts/do-fleet.sh +50 -1
  48. package/scripts/do-killswitch-audit.py +33 -14
  49. package/scripts/do-promise-lint.sh +150 -4
  50. package/scripts/do-promise-settle.sh +131 -9
  51. package/scripts/do-prove.sh +197 -17
  52. package/scripts/do-rank.py +606 -20
  53. package/scripts/do-rubric.py +21 -2
  54. package/scripts/do-signal.sh +157 -17
  55. package/scripts/do-smoke.sh +9 -0
  56. package/scripts/do-substrate-check.sh +49 -0
  57. package/scripts/do-tasks-wire-check.sh +81 -0
  58. package/scripts/do-tier.sh +90 -5
  59. package/scripts/do-ui-gate.sh +332 -0
  60. package/scripts/do-untracked-gate.sh +231 -0
  61. package/scripts/do-walk.sh +344 -0
  62. package/scripts/factory-check.sh +747 -0
  63. package/scripts/factory-repo.sh +1361 -0
  64. package/scripts/factory-tasks-check.sh +85 -0
  65. package/scripts/outcome-pull.ts +279 -0
  66. package/scripts/promise-manifest.mjs +167 -0
  67. package/scripts/reconcile-allow.txt +5 -0
  68. package/scripts/rubric-weights.json +64 -0
  69. package/scripts/spine-canary.sh +20 -0
  70. package/scripts/typedb-cluster-status.sh +128 -0
  71. package/scripts/typedb-env.sh +182 -0
  72. package/scripts/typedb-flap-recorder.sh +85 -0
  73. package/scripts/typedb-probes/containment-probe.py +88 -0
  74. package/scripts/typedb-probes/panic-probe-version.py +92 -0
  75. package/scripts/typedb-probes/panic-probe.py +77 -0
  76. package/scripts/typedb-scratch.sh +73 -0
  77. package/scripts/urls-lint.sh +58 -0
  78. package/scripts/w4-rubric.ts +96 -12
  79. package/scripts/wf-check.mjs +75 -0
  80. package/skills/ai-ui/SKILL.md +1 -1
  81. package/skills/astro/SKILL.md +177 -132
  82. package/skills/astro/add-content-collection.md +29 -13
  83. package/skills/astro/check-build.md +19 -13
  84. package/skills/astro/create-component.md +36 -9
  85. package/skills/astro/create-page.md +39 -10
  86. package/skills/astro/optimize-performance.md +36 -8
  87. package/skills/cli/SKILL.md +254 -220
  88. package/skills/dev/SKILL.md +1 -1
  89. package/skills/directory-autofill/SKILL.md +68 -0
  90. package/skills/docs/SKILL.md +4 -4
  91. package/skills/mcp/SKILL.md +186 -156
  92. package/skills/promise-make/SKILL.md +2 -2
  93. package/skills/puck/SKILL.md +465 -250
  94. package/skills/react19/SKILL.md +196 -296
  95. package/skills/reactflow/SKILL.md +387 -412
  96. package/skills/sdk/SKILL.md +167 -106
  97. package/skills/shadcn/SKILL.md +245 -201
  98. package/skills/signal/SKILL.md +5 -0
  99. package/skills/sui/SKILL.md +6 -1
  100. package/skills/tutorial/SKILL.md +15 -0
  101. package/skills/typedb/SKILL.md +427 -217
  102. package/skills/typedb/examples/python-patterns.py +11 -4
  103. package/skills/typedb/examples/query-patterns.tql +8 -3
  104. package/skills/typedb/examples/schema-patterns.tql +4 -2
  105. package/skills/typedb/reference/migration-2x-3x.md +19 -1
  106. package/skills/typedb/reference/python-driver.md +17 -1
  107. package/skills/voice/SKILL.md +117 -0
  108. package/skills/writer/SKILL.md +29 -12
  109. package/templates/template-feature.md +26 -1
  110. package/templates/template-tests.md +4 -0
  111. package/templates/template-todo.md +65 -10
@@ -1,3 +1,8 @@
1
+ ---
2
+ name: sdk
3
+ description: Extend or read @oneie/sdk — the receiver registry, SubstrateClient methods, and the barrel exports. Use when adding an SDK method, declaring a new receiver contract, checking whether a receiver name is real before writing signal()/ask(), picking the right import path (bare barrel vs subpath), or exporting a new SDK type. Triggers — "add an SDK method", "add a receiver", "is <x:y> a real receiver", "typed ask/signal", "export this from the SDK", "which @oneie/sdk import path", "signals-parity is failing".
4
+ ---
5
+
1
6
  # @oneie/sdk — SDK client methods and type exports
2
7
 
3
8
  The SDK is the client-side interface to ONE. It's where agents and apps interact with the substrate.
@@ -7,191 +12,247 @@ The SDK is the client-side interface to ONE. It's where agents and apps interact
7
12
  ```
8
13
  packages/sdk/
9
14
  ├── src/
10
- │ ├── index.ts # barrel: exports all public types + client
11
- │ ├── client.ts # SubstrateClient class with all methods
12
- │ ├── types/ # interface definitions
13
- ├── index.ts # re-exports all types
14
- ├── actor.ts
15
- ├── group.ts
16
- │ └── {domain}.ts # new domains go here
17
- │ ├── brain/ # TypeDB queries (never imported from Workers)
18
- └── receivers.ts # typed receiver registry
15
+ │ ├── index.ts # barrel the public surface
16
+ │ ├── client.ts # SubstrateClient every method
17
+ │ ├── receivers.ts # RECEIVERS + RECIPES — capability
18
+ │ ├── types.ts # SdkConfig, Outcome, shared shapes
19
+ │ ├── schemas.ts # hand-written zod schemas
20
+ │ ├── errors.ts # SubstrateError + subclasses
21
+ ├── brain.ts # BrainClient graph-in-RAM
22
+ │ ├── gateway.ts # GatewayClient raw TypeQL
23
+ ├── generated/ # codegen from schema/*.tql
24
+ │ └── {domain}.ts # pay, skills, broadcast, wallet…
25
+ ├── scripts/
26
+ │ └── signals-parity.ts # guards receiver counts
27
+ └── tests/ # vitest, 24 suites (+ test/, 3 more)
19
28
  ```
20
29
 
30
+ There is no `src/types/` directory and no `src/brain/` directory — types are one
31
+ flat `types.ts` plus per-domain files; brain and gateway are single modules.
32
+
21
33
  ## Pattern: Adding a new public method
22
34
 
23
- ### 1. Define the types (in `packages/sdk/src/types/{domain}.ts`)
35
+ ### 1. Declare the receiver contract (in `packages/sdk/src/receivers.ts`)
24
36
 
25
- ```typescript
26
- // packages/sdk/src/types/memory.ts
27
- export interface Memory {
28
- id: string;
29
- groupId: string;
30
- content: string;
31
- createdAt: Date;
32
- }
37
+ Capability starts in the registry, not on the client. Each entry is a
38
+ `receiver({ … })` call with zod request/response plus agent-ergonomic metadata.
33
39
 
34
- export interface CreateMemoryInput {
35
- groupId: string;
36
- content: string;
37
- }
38
-
39
- export type MemoryResponse = Memory | null;
40
+ ```typescript
41
+ // packages/sdk/src/receivers.ts
42
+ export const RECEIVERS = {
43
+ "links:create": receiver({
44
+ receiver: "links:create",
45
+ summary: "Create an actor-bound tracked link.",
46
+ request: z.object({
47
+ actorId: z.string().describe("Contact the link is bound to"),
48
+ destination: z.string().optional().describe("Path the click lands on"),
49
+ expiresInDays: z.number().optional().describe("TTL in days"),
50
+ }),
51
+ response: z.object({ id: z.string(), sig: z.string(), url: z.string() }),
52
+ effect: "ask", cost: "free", reversible: false,
53
+ idempotent: false, auth: "member",
54
+ }),
55
+ } as const;
40
56
  ```
41
57
 
58
+ The handler binds elsewhere — `one.ie/web/src/lib/world-receivers.ts` (and its
59
+ `resolvers/` modules) for web, channels tool modules for the agent worker. The
60
+ SDK ships the catalog; the services ship the implementations.
61
+
42
62
  ### 2. Add the method to SubstrateClient
43
63
 
64
+ Most receivers need no method at all — `one.ask("links:create", …)` is already
65
+ typed off the registry. Add a method only when you want sugar over the outcome.
66
+
44
67
  ```typescript
45
68
  // packages/sdk/src/client.ts
46
69
  export class SubstrateClient {
47
- async memory(groupId: string): Promise<MemoryResponse> {
48
- return this.signal("chat:memory", { groupId });
49
- }
50
-
51
- async createMemory(input: CreateMemoryInput): Promise<Memory> {
52
- return this.signal("chat:memory:create", input);
53
- }
54
-
55
- async updateMemory(id: string, content: string): Promise<Memory> {
56
- return this.signal("chat:memory:update", { id, content });
70
+ /** Sugar over `ask("links:create", )`; the receiver walks authority
71
+ * server-side. Returns the result outcome, or null otherwise. */
72
+ async createLink(opts: {
73
+ actorId: string;
74
+ destination?: string;
75
+ expiresInDays?: number;
76
+ }): Promise<{ id: string; sig: string; url: string } | null> {
77
+ const outcome = await this.ask("links:create", opts);
78
+ return outcome.kind === "result"
79
+ ? (outcome.result as { id: string; sig: string; url: string })
80
+ : null;
57
81
  }
58
82
  }
59
83
  ```
60
84
 
61
85
  **Rules:**
62
- - Method name matches the domain (memory, task, etc.)
63
- - Method calls `this.signal()` never make HTTP calls directly
64
- - Input is typed (CreateMemoryInput, not `any`)
65
- - Return type is explicit (MemoryResponse, not `Promise<any>`)
66
- - No logic inside the method it's a transport layer only
86
+ - Method name matches the domain (`createLink`, `listGroups`, `authAgent`)
87
+ - Method calls `this.signal()` / `this.ask()` / the private `this.r()` — never
88
+ a bare `fetch` to a URL it invents
89
+ - Input is typed (an inline options object or a named interface, not `any`)
90
+ - Return type is explicitnever `Promise<any>`
91
+ - `ask()` returns `Outcome<T>` with a `kind` of `result | timeout | dissolved |
92
+ failure`. The caller MUST close the loop; a method that silently drops the
93
+ three non-`result` kinds is a locked-rule violation
67
94
 
68
- ### 3. Export types from barrel
95
+ ### 3. Export from the barrel
69
96
 
70
97
  ```typescript
71
- // packages/sdk/src/types/index.ts
72
- export { Memory, CreateMemoryInput, MemoryResponse } from './memory';
73
-
74
98
  // packages/sdk/src/index.ts
75
- export type { Memory, CreateMemoryInput } from './types';
76
- export { SubstrateClient } from './client';
99
+ export { SubstrateClient } from "./client.js";
100
+ export { receiver, RECEIVERS, RECIPES } from "./receivers.js";
101
+ export type { Receiver, ReceiverName, ReqOf, ResOf } from "./receivers.js";
77
102
  ```
78
103
 
79
104
  **Rules:**
80
- - Export types separately from client (consumers may only import types)
81
- - Use `export type` not `export interface` (better tree-shaking)
82
- - Re-export from barrel `index.ts` files
105
+ - `.js` extensions in every relative import the package is ESM-only
106
+ - Types are exported with `export type` so consumers can import types alone
107
+ - If the module must be importable from a Cloudflare Worker, add a subpath to
108
+ `exports` in `package.json` (`"./receivers"`, `"./gateway"`, `"./wallet"`, …).
109
+ Workers must import by module path — the bare `@oneie/sdk` barrel crashes them
83
110
 
84
111
  ## Pattern: Receiver registration
85
112
 
86
- Every SDK method must correspond to a receiver in `packages/sdk/src/receivers.ts`:
113
+ `RECEIVERS` is the one source of truth for capability. Every name you pass to
114
+ `signal()` or `ask()` must be a key in it — 273 receivers across 69 namespaces
115
+ as of 2026-08-02. Read the registry for the live number; never hand-type one.
116
+
117
+ Typing works by inference off the registry, with an escape hatch:
87
118
 
88
119
  ```typescript
89
- // packages/sdk/src/receivers.ts
90
- export const RECEIVERS = {
91
- 'chat:memory': { actor: 'agent|human', schema: 'chat-memory', returns: 'memory' },
92
- 'chat:memory:create': { actor: 'agent', schema: 'create-memory', returns: 'memory' },
93
- 'chat:memory:update': { actor: 'agent|human', schema: 'update-memory', returns: 'memory' },
94
- } as const;
120
+ await one.ask("world:create-actor", { name, type }) // typed request + Outcome
121
+ await one.ask("world:create-actor", { wrong: 1 }) // compile error
122
+ await one.ask("dynamic:thing", { anything: 1 }) // escape hatch (unknown)
95
123
  ```
96
124
 
125
+ The escape hatch is why a fictional receiver still type-checks and then 404s at
126
+ runtime. **Grep `receivers.ts` before writing any example.** Known non-receivers
127
+ that read plausibly: there is no `inbox:` namespace and no `learning:know` key.
128
+
97
129
  **Rules:**
98
- - Receiver name must match the signal name passed to `this.signal()`
99
- - Actor declares who can call it (agent, human, or both)
100
- - Schema is the data shape (links to TypeDB query or D1 table)
101
- - Returns type is explicit (no `any`)
130
+ - Receiver name is `namespace:verb` the colon lane is reserved (`text/dictionary.md`)
131
+ - `effect` declares `signal` (fire-and-forget) vs `ask` (awaits an outcome)
132
+ - `auth` declares who may call it (`public` · `member` · `owner` · `agent_key` · `none`)
133
+ - `request` / `response` are zod — they feed OpenAPI, MCP tool schemas, and `meta:catalog`
134
+ - After adding one, run `bun packages/sdk/scripts/signals-parity.ts` — it compares
135
+ per-namespace counts against `text/signals-catalog.md` and exits non-zero on drift
102
136
 
103
137
  ## Pattern: Testing SDK methods
104
138
 
139
+ Client tests intercept `fetch` to verify the request shape — that is not a
140
+ substrate mock, it's a transport assertion.
141
+
105
142
  ```typescript
106
- // packages/sdk/test/client.test.ts
107
- describe('SubstrateClient.memory()', () => {
108
- it('fetches memory for a group', async () => {
109
- const client = new SubstrateClient({ endpoint: 'http://localhost:3000' });
110
- const memory = await client.memory('group-123');
111
- expect(memory).toEqual({
112
- id: expect.any(String),
113
- content: expect.any(String),
143
+ // packages/sdk/tests/group-ops.test.ts
144
+ import { beforeEach, describe, expect, it, vi } from "vitest";
145
+ import { SubstrateClient } from "../src/client.js";
146
+
147
+ let calls: Array<{ url: string; init: RequestInit }>;
148
+
149
+ beforeEach(() => {
150
+ calls = [];
151
+ globalThis.fetch = vi.fn(async (url, init) => {
152
+ calls.push({ url: String(url), init: init ?? {} });
153
+ return new Response(JSON.stringify({ ok: true }), {
154
+ status: 200,
155
+ headers: { "Content-Type": "application/json" },
114
156
  });
115
- });
157
+ }) as unknown as typeof fetch;
158
+ });
116
159
 
117
- it('returns null if no memory exists', async () => {
118
- const client = new SubstrateClient({ endpoint: 'http://localhost:3000' });
119
- const memory = await client.memory('nonexistent-group');
120
- expect(memory).toBeNull();
160
+ describe("createGroup", () => {
161
+ it("threads parentGid through as parent_gid", async () => {
162
+ const one = new SubstrateClient({ baseUrl: "https://one.ie", apiKey: "k" });
163
+ await one.createGroup({ gid: "group:acme-mkt", name: "Marketing", parentGid: "group:acme" });
164
+ const call = calls.find((c) => c.url.endsWith("/api/groups"));
165
+ expect(JSON.parse(String(call?.init.body)).parent_gid).toBe("group:acme");
121
166
  });
122
167
  });
123
168
  ```
124
169
 
125
170
  **Rules:**
126
- - Test the happy path (data exists)
127
- - Test the empty path (no data)
128
- - Test error handling (network failure, validation error)
129
- - Don't mock — use integration test against real receiver
171
+ - `bun run test` in `packages/sdk` (vitest)
172
+ - Assert the request shape (path, method, body keys) — that's what the SDK owns
173
+ - Assert every `Outcome` kind the method branches on, not just `result`
174
+ - Don't mock TypeDB or Sui real data or skip (`.claude/rules/engine.md`)
175
+ - `emit()` telemetry also posts to `/api/signal`; filter to the call under test
130
176
 
131
177
  ## Anti-patterns
132
178
 
133
- **Direct HTTP calls in client methods**
179
+ **Direct HTTP calls in client methods**
134
180
  ```typescript
135
181
  // WRONG
136
- async getMemory() {
137
- return fetch('/api/memory').then(r => r.json());
182
+ async getBroadcast(id: string) {
183
+ return fetch('/api/broadcasts/' + id).then(r => r.json());
138
184
  }
139
185
  ```
140
- **Fix:** Use `this.signal('chat:memory', {})` — the receiver handles HTTP.
186
+ **Fix:** Use `this.ask('broadcast:get', { broadcastId: id })` — the receiver owns the route.
141
187
 
142
- **Untyped inputs/outputs**
188
+ **Untyped inputs/outputs**
143
189
  ```typescript
144
190
  // WRONG
145
- async memory(input: any): Promise<any> {
146
- return this.signal('chat:memory', input);
191
+ async createLink(input: any): Promise<any> {
192
+ return this.ask('links:create', input);
147
193
  }
148
194
  ```
149
- **Fix:** Create CreateMemoryInput and MemoryResponse types.
195
+ **Fix:** Type the options object and the return; let `ReqOf`/`ResOf` infer.
150
196
 
151
- **SDK logic**
197
+ **Dropping the outcome**
152
198
  ```typescript
153
199
  // WRONG
154
- async memory(groupId: string) {
155
- const memory = await this.signal('chat:memory', { groupId });
156
- return memory?.content.toUpperCase(); // NO logic in SDK
200
+ async createLink(opts: LinkOpts) {
201
+ const outcome = await this.ask('links:create', opts);
202
+ return outcome.result; // undefined on timeout | dissolved | failure
157
203
  }
158
204
  ```
159
- **Fix:** Logic lives in the receiver or component, not SDK.
205
+ **Fix:** Branch on `outcome.kind` and return a closed shape (`… | null`).
160
206
 
161
- **Receiver without registration**
207
+ **SDK logic**
208
+ ```typescript
209
+ // WRONG
210
+ async createLink(opts: LinkOpts) {
211
+ const o = await this.ask('links:create', opts);
212
+ return o.result?.url.toUpperCase(); // NO — logic in SDK
213
+ }
214
+ ```
215
+ **Fix:** Logic lives in the receiver or the component, not the SDK.
216
+
217
+ **Method without a receiver**
162
218
  ```typescript
163
219
  // WRONG — method exists, but no entry in RECEIVERS
164
220
  async customAction() {
165
- return this.signal('custom:action', {}); // Not in RECEIVERS
221
+ return this.signal('custom:action', {}); // escape hatch → 404 at runtime
166
222
  }
167
223
  ```
168
- **Fix:** Add the receiver to `receivers.ts` before adding the method.
224
+ **Fix:** Add the receiver to `receivers.ts` first, then the method.
225
+
226
+ **Bare barrel import in a Worker**
227
+ ```typescript
228
+ // WRONG — crashes on Cloudflare Workers
229
+ import { RECEIVERS } from '@oneie/sdk';
230
+ ```
231
+ **Fix:** `import { RECEIVERS } from '@oneie/sdk/receivers'`.
169
232
 
170
233
  ## Composability rules
171
234
 
172
235
  **New domain method composes existing types:**
173
236
  ```typescript
174
- // GOOD — reuses Group, Actor, Path
175
- interface Memory {
176
- id: string;
177
- group: Group; // don't duplicate Group fields
178
- owner: Actor; // don't redefine actor structure
237
+ // GOOD — reuses the shipped Outcome + registry inference
238
+ async createLink(opts: LinkOpts): Promise<LinkResult | null> {
239
+ const outcome = await this.ask("links:create", opts);
240
+ return outcome.kind === "result" ? outcome.result : null;
179
241
  }
180
242
  ```
181
243
 
182
- **New domain introduces its own shape:**
244
+ **New domain introduces its own module:**
183
245
  ```typescript
184
- // GOOD — when memory has no analogue in existing types
185
- interface Memory {
186
- id: string;
187
- content: string; // novel field, no existing type
188
- context: Map<string, string>; // novel structure
189
- }
246
+ // GOOD — a domain with its own transport (pay, skills, wallet, broadcast)
247
+ // lives in src/{domain}.ts, gets a package.json subpath, and is bound onto
248
+ // the client in the constructor:
249
+ // this.pay = { accept: (o) => payAccept(o, cfg), }
190
250
  ```
191
251
 
192
252
  ## See also
193
253
 
194
- - `packages/sdk/CLAUDE.md` — SDK development guide
195
- - `text/receiver-names-shipped-vs-spec.md` — which receivers are actually implemented
254
+ - `packages/sdk/CLAUDE.md` — SDK operating manual (verbs table, security boundaries)
196
255
  - `packages/sdk/src/receivers.ts` — canonical receiver registry
256
+ - `text/signals-catalog.md` — the generated namespace map (parity-guarded)
257
+ - `text/agent-first-spec-plan.md` — why the registry is the capability contract
197
258
  - `text/api.md` — API endpoint spec (SDK methods wrap endpoints)