@shardworks/guild-starter-kit 0.1.33 → 0.1.35

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.
@@ -23,18 +23,20 @@ An anima is the fundamental unit of identity in the guild. Animas are animated b
23
23
  ### Standing vs. Commissioned
24
24
 
25
25
  - **Standing** animas persist on the roster indefinitely, called on by name. The advisor is a standing anima.
26
- - **Commissioned** animas are created for a specific commission and their tenure ends when the commission completes. Artificers are typically commissioned.
26
+ - **Commissioned** animas are created for a specific commission and their tenure ends when the commission completes.
27
27
 
28
28
  ## Roles
29
29
 
30
- Roles define what kind of work an anima performs.
30
+ Roles define what kind of work an anima performs. Roles are not a fixed set — a guild defines its own roles to match how it organizes work. The framework provides infrastructure for roles (registration, tool gating, role resolution in standing orders) but does not prescribe which roles a guild must have.
31
+
32
+ This guild uses the following roles:
31
33
 
32
34
  | Role | Function |
33
35
  |------|----------|
34
36
  | **Advisor** | Helps the patron understand and use the guild. Answers questions, explains state, suggests actions. Does not implement. |
35
- | **Artificer** | Undertakes commissions — receives a plan and builds the thing. Works in workshops. |
36
- | **Sage** | Plans commission work. Refines vague instructions into concrete requirements. |
37
- | **Master Sage** | Senior sage. If active, must be consulted before any commission is undertaken. |
37
+ | **Artificer** | Executes jobs — receives planned work and builds the thing. Works in workshops. |
38
+ | **Sage** | Plans work. Decomposes commissions into pieces and jobs with concrete requirements. |
39
+ | **Master Sage** | Senior sage. If active, reviews incoming commissions to determine scope and planning approach. |
38
40
 
39
41
  Other roles may emerge as the guild evolves.
40
42
 
@@ -42,7 +44,7 @@ Other roles may emerge as the guild evolves.
42
44
 
43
45
  A workshop is a repository where animas do their work. Workshops are guild space — the patron assigns them, but during normal operation the patron judges results by the works produced, not by inspecting the workshop directly.
44
46
 
45
- Each workshop is registered in `guild.json` under the `workshops` key with its name, remote URL, and the timestamp it was added. On disk, the guild maintains a bare clone of each workshop at `.nexus/workshops/{name}.git`. Commission worktrees are created from these bare clones, giving each commission an isolated working directory.
47
+ Each workshop is registered in `guild.json` under the `workshops` key with its name, remote URL, and the timestamp it was added. On disk, the guild maintains a bare clone of each workshop at `.nexus/workshops/{name}.git`. Worktrees are created from these bare clones, giving each job an isolated working directory.
46
48
 
47
49
  ### Managing Workshops
48
50
 
@@ -102,7 +104,7 @@ If `gh` is not installed or not authenticated, the command fails with a clear me
102
104
  `nsg workshop list` shows each workshop with:
103
105
 
104
106
  - **✓ / ✗** — whether the bare clone exists on disk (it may be missing after a fresh guild clone before running `nsg guild restore`)
105
- - **Active worktrees** — how many commissions currently have worktrees checked out
107
+ - **Active worktrees** — how many jobs currently have worktrees checked out
106
108
  - **Remote URL** — where the repo lives
107
109
 
108
110
  If a bare clone is missing, the output includes a hint to run `nsg guild restore`.
@@ -113,17 +115,17 @@ If a bare clone is missing, the output includes a hint to run `nsg guild restore
113
115
  nsg workshop remove my-app
114
116
  ```
115
117
 
116
- This deletes the bare clone, any commission worktrees for that workshop, and removes the entry from `guild.json`. This is a destructive operation — the workshop's local state is gone. The remote repository is not affected.
118
+ This deletes the bare clone, any job worktrees for that workshop, and removes the entry from `guild.json`. This is a destructive operation — the workshop's local state is gone. The remote repository is not affected.
117
119
 
118
- ### How Workshops Are Used in Commissions
120
+ ### How Workshops Are Used
119
121
 
120
- When a commission is dispatched to a workshop, the workshop-prepare engine:
122
+ When a job is dispatched to a workshop, the workshop-prepare engine:
121
123
 
122
- 1. Creates a commission-specific branch from `main` in the workshop's bare clone
124
+ 1. Creates a job-specific branch from `main` in the workshop's bare clone
123
125
  2. Checks out a git worktree at `.nexus/worktrees/{workshop}/commission-{id}/`
124
126
  3. The anima works in this isolated directory
125
127
 
126
- This means multiple commissions can run concurrently in the same workshop without interfering with each other — each gets its own branch and working directory.
128
+ This means multiple jobs can run concurrently in the same workshop without interfering with each other — each gets its own branch and working directory.
127
129
 
128
130
  ### guild.json Shape
129
131
 
@@ -140,20 +142,45 @@ This means multiple commissions can run concurrently in the same workshop withou
140
142
 
141
143
  The `remoteUrl` is the source of truth. The bare clone on disk is ephemeral and can be reconstructed from this URL by `nsg guild restore`.
142
144
 
143
- ## Commissions
145
+ ## Commissions and Work Decomposition
146
+
147
+ A commission is the patron's act of requesting work. The guild receives commissions and organizes the resulting labor through a four-level decomposition hierarchy:
148
+
149
+ ### The Shape of Labor
150
+
151
+ | Level | What It Is | Who Handles It (in this guild) |
152
+ |-------|-----------|-------------------------------|
153
+ | **Work** | A large undertaking — too broad to plan directly, must be broken into pieces | Sage decomposes into pieces |
154
+ | **Piece** | An independently-plannable chunk of a work | Sage plans into concrete jobs |
155
+ | **Job** | A single assignment for one anima — one continuous effort, one deliverable | Artificer executes |
156
+ | **Stroke** | An atomic, verifiable action within a job — one test, one function, one integration step | Artificer records and completes |
144
157
 
145
- A commission is a unit of work posted by the patron and undertaken by the guild. Commissions flow through an event-driven pipeline powered by standing orders:
158
+ Not every commission becomes a work. A small commission might map directly to a single job. The hierarchy describes the shape of the labor, not a mandatory sequence of steps.
146
159
 
147
160
  ### Commission Lifecycle
148
161
 
149
162
  1. **Posted** — the patron runs `nsg commission <spec> --workshop <name>`. This creates the commission in the Ledger and signals `commission.posted`.
150
- 2. **Worktree prepared** — the `workshop-prepare` engine (triggered by `commission.posted`) creates a commission branch and worktree, then signals `commission.ready`.
151
- 3. **Assigned & In Progress** — the Clockworks summons an artificer (triggered by `commission.ready`), resolves a role to a specific anima, writes the assignment, and launches a session.
152
- 4. **Session ended** — when the artificer's session finishes, the Clockworks signals `commission.session.ended`.
153
- 5. **Merged or Failed** — the `workshop-merge` engine (triggered by `commission.session.ended`) merges the commission branch back to main. On success it signals `commission.completed`; on conflict it signals `commission.failed`.
163
+ 2. **Scope determined** — the Master Sage (if active) reviews the commission and determines whether it's a work (needs decomposition), a piece (needs planning into jobs), or a single job (ready for dispatch).
164
+ 3. **Planned** — for works and pieces, the sage decomposes and plans, producing concrete jobs with acceptance criteria.
165
+ 4. **Worktree prepared** — the `workshop-prepare` engine (triggered by `commission.posted`) creates a job branch and worktree, then signals `commission.ready`.
166
+ 5. **Dispatched & In Progress** — the Clockworks summons an artificer (triggered by `commission.ready`), resolves the role to a specific anima, writes the assignment, and launches a session.
167
+ 6. **Strokes recorded** — the artificer plans strokes at the start of the job and records progress throughout. Each stroke is tracked in the Ledger.
168
+ 7. **Session ended** — when the session finishes, the Clockworks checks the stroke record. If pending strokes remain, the anima is re-summoned in a fresh session (staged sessions). If all strokes are complete, the Clockworks signals `commission.session.ended`.
169
+ 8. **Merged or Failed** — the `workshop-merge` engine (triggered by `commission.session.ended`) merges the job branch back to main. On success it signals `commission.completed`; on conflict it signals `commission.failed`.
154
170
 
155
171
  Each step is driven by a standing order in `guild.json`, making the pipeline configurable and extensible.
156
172
 
173
+ ### Staged Sessions
174
+
175
+ A job may span multiple sessions when the context window fills up. The stroke record provides continuity between sessions:
176
+
177
+ - The anima records strokes via tool throughout the job
178
+ - When a session ends with pending strokes, the Clockworks re-summons the anima in a fresh session
179
+ - The next session receives the original job spec plus the stroke record — a structured checklist of what's done and what remains
180
+ - The anima picks up where the previous session left off
181
+
182
+ The anima does not need to write freeform handoff notes — the stroke record is the handoff.
183
+
157
184
  ### Commission Status Flow
158
185
 
159
186
  ```
@@ -163,7 +190,7 @@ posted → in_progress → completed
163
190
 
164
191
  ## Sessions
165
192
 
166
- A session is a single manifestation of an anima — the span during which an anima is alive and working. Every interaction with an anima happens through a session, whether it's consulting the advisor, summoning an artificer for a commission, or briefing an anima about an event.
193
+ A session is a single manifestation of an anima — the span during which an anima is alive and working. Every interaction with an anima happens through a session, whether it's consulting the advisor, dispatching a job, or briefing an anima about an event.
167
194
 
168
195
  ### Session Triggers
169
196
 
@@ -206,7 +233,7 @@ The `sessions` table tracks every session with:
206
233
  - Start/end times, exit code, token usage, cost, and duration
207
234
  - A link to the full session record JSON on disk
208
235
 
209
- For commissions, the `commission_sessions` join table links commissions to their sessions — a commission may involve multiple sessions (retries, sub-tasks).
236
+ For commissions, the `commission_sessions` join table links commissions to their sessions — a commission may involve multiple sessions (staged sessions, retries).
210
237
 
211
238
  ## Tools
212
239
 
@@ -226,13 +253,13 @@ Engines are automated mechanical processes with no AI involvement. Two kinds:
226
253
  **Core engines** — fundamental capabilities absorbed into the Nexus framework itself (`@shardworks/nexus-core`). These are not registered in `guild.json` as engines — they are framework internals that the system calls directly:
227
254
 
228
255
  - **manifest** — assembles an anima's identity for a session (codex, curriculum, temperament, tool instructions → system prompt)
229
- - **worktree** — creates and manages git worktrees for commissions and temporary sessions
256
+ - **worktree** — creates and manages git worktrees for jobs
230
257
  - **migrate** — applies database migrations to the Ledger
231
258
 
232
259
  **Clockwork engines** — purpose-built to respond to events via standing orders. Use the `engine()` SDK factory from `@shardworks/nexus-core`. The Clockworks runner calls them automatically when matching events fire. Packaged in `@shardworks/nexus-stdlib`:
233
260
 
234
261
  - **workshop-prepare** — creates a worktree when a commission is posted (`commission.posted` → `commission.ready`)
235
- - **workshop-merge** — merges a commission branch after the session ends (`commission.session.ended` → `commission.completed` or `commission.failed`)
262
+ - **workshop-merge** — merges a job branch after the session ends (`commission.session.ended` → `commission.completed` or `commission.failed`)
236
263
 
237
264
  ### Session Providers
238
265
 
@@ -248,7 +275,7 @@ Role-specific codex entries live in `codex/roles/` and are delivered only to ani
248
275
 
249
276
  ## The Ledger
250
277
 
251
- The guild's operational database (SQLite). Holds anima records, roster, commission history, session history, compositions, events, and the audit trail. Lives at `.nexus/nexus.db` in the guildhall. Managed by the migrate engine in core.
278
+ The guild's operational database (SQLite). Holds anima records, roster, commission history, work decomposition state, session history, compositions, events, and the audit trail. Lives at `.nexus/nexus.db` in the guildhall. Managed by the migrate engine in core.
252
279
 
253
280
  ### Key Tables
254
281
 
@@ -274,7 +301,7 @@ An event is an immutable fact: *this happened*. Events are recorded in the Ledge
274
301
 
275
302
  Two kinds:
276
303
 
277
- - **Framework events** — signaled automatically by the system. Animas cannot signal these. Reserved namespaces: `anima.*`, `commission.*`, `tool.*`, `migration.*`, `guild.*`, `standing-order.*`, `session.*`.
304
+ - **Framework events** — signaled automatically by the system. Animas cannot signal these. Reserved namespaces: `anima.*`, `commission.*`, `work.*`, `piece.*`, `job.*`, `stroke.*`, `tool.*`, `migration.*`, `guild.*`, `standing-order.*`, `session.*`.
278
305
  - **Custom events** — declared by the guild in `guild.json` under `clockworks.events`. Animas signal these using the `signal` tool.
279
306
 
280
307
  ### Key Framework Events
@@ -283,9 +310,14 @@ Two kinds:
283
310
  |-------|--------------|----------------------|
284
311
  | `commission.posted` | A new commission is created | `run: workshop-prepare` |
285
312
  | `commission.ready` | Worktree is set up, commission is ready for work | `summon: artificer` |
286
- | `commission.session.ended` | An artificer's session finishes | `run: workshop-merge` |
313
+ | `commission.session.ended` | A job session finishes (all strokes complete) | `run: workshop-merge` |
287
314
  | `commission.completed` | Commission branch merged to main | (guild-defined) |
288
315
  | `commission.failed` | Commission failed (merge conflict, error) | (guild-defined) |
316
+ | `work.created` | A work is created in the decomposition hierarchy | (guild-defined) |
317
+ | `piece.ready` | A piece is ready for planning | (guild-defined) |
318
+ | `job.ready` | A job is ready for dispatch | (guild-defined) |
319
+ | `job.completed` | A job completes successfully | (guild-defined) |
320
+ | `stroke.recorded` | A stroke is planned or completed | (guild-defined) |
289
321
  | `session.started` | Any session begins | (guild-defined) |
290
322
  | `session.ended` | Any session ends (with metrics) | (guild-defined) |
291
323
  | `standing-order.failed` | A standing order execution failed | (guild-defined) |
@@ -311,7 +343,7 @@ Example `guild.json` configuration:
311
343
  "clockworks": {
312
344
  "events": {
313
345
  "code.reviewed": {
314
- "description": "Signaled when an artificer completes a code review"
346
+ "description": "Signaled when an anima completes a code review"
315
347
  }
316
348
  },
317
349
  "standingOrders": [
@@ -333,7 +365,7 @@ Use the **signal** tool to signal custom events:
333
365
  signal({ name: "code.reviewed", payload: { pr: 42, issues_found: 0 } })
334
366
  ```
335
367
 
336
- The event name must be declared in `guild.json clockworks.events`. Framework namespaces (`anima.*`, `commission.*`, `tool.*`, `migration.*`, `guild.*`, `standing-order.*`, `session.*`) are reserved.
368
+ The event name must be declared in `guild.json clockworks.events`. Framework namespaces are reserved.
337
369
 
338
370
  ### Processing Events
339
371
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shardworks/guild-starter-kit",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "description": "Default bundle for new Nexus guilds — tools, training, and migrations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,16 +11,27 @@ You are an artisan — methodical, resourceful, and focused on delivering solid
11
11
 
12
12
  ## Your Work Environment
13
13
 
14
- You work in an **autonomous session** — there is no human at the keyboard. Your session is launched by the Clockworks in response to a commission, and your commission spec arrives as the initial prompt. That spec is your entire brief. Read it carefully.
14
+ You work in an **autonomous session** — there is no human at the keyboard. Your session is launched by the Clockworks in response to a job, and your job spec arrives as the initial prompt. That spec is your entire brief. Read it carefully.
15
15
 
16
- You work in an **isolated worktree** — a dedicated branch and working directory created just for your commission. Other commissions may be running concurrently in the same workshop, each in their own worktree. You cannot see or affect their work, and they cannot see or affect yours.
16
+ You work in an **isolated worktree** — a dedicated branch and working directory created just for your job. Other jobs may be running concurrently in the same workshop, each in their own worktree. You cannot see or affect their work, and they cannot see or affect yours.
17
17
 
18
- When your session ends, the **workshop-merge engine** automatically merges your commission branch back to main. This merge is a **fast-forward only** — if main has moved since your branch was created (because another commission merged first), your commission will fail. This means:
18
+ When your job is complete, the **workshop-merge engine** automatically merges your branch back to main. This merge is a **fast-forward only** — if main has moved since your branch was created (because another job merged first), your job will fail. This means:
19
19
 
20
20
  - **Commit early and often.** Small, atomic commits. If your session is interrupted, committed work survives.
21
- - **Keep your changes focused.** Touching files outside your commission's scope increases the chance of merge conflicts with concurrent work.
21
+ - **Keep your changes focused.** Touching files outside your job's scope increases the chance of merge conflicts with concurrent work.
22
22
  - **Push the branch forward, not sideways.** Don't rewrite history or rebase within your worktree. The merge engine expects a clean, linear branch.
23
23
 
24
+ ## Strokes — Planning and Tracking Your Work
25
+
26
+ At the start of a job, plan your work as **strokes** — atomic, verifiable actions. Record them using the stroke tool. Each stroke should be a single deliberate step: one function implemented, one test written, one integration wired up.
27
+
28
+ - **Plan strokes early.** Before you start coding, record your planned strokes. This externalizes your plan and makes it durable — if your session ends unexpectedly, the plan survives.
29
+ - **Mark strokes complete as you go.** After finishing each stroke, mark it complete via the tool. This keeps the record current.
30
+ - **Add strokes as you discover work.** Your initial plan won't be perfect. When you discover something that needs doing, add a new stroke. The stroke record is a living checklist, not a rigid contract.
31
+ - **Keep strokes atomic.** Each stroke should be independently verifiable. "Implement retry logic and write tests" is two strokes, not one.
32
+
33
+ The stroke record serves as your job's progress tracker. If your session runs long and the system re-summons you in a fresh context window, the stroke record tells the next session exactly where things stand — no freeform notes needed.
34
+
24
35
  ## Communication Style
25
36
 
26
37
  - Be concise. Commit messages and code comments are your primary output — make them clear and useful for the next anima who reads them.
@@ -30,6 +41,6 @@ When your session ends, the **workshop-merge engine** automatically merges your
30
41
  ## Work Ethic
31
42
 
32
43
  - Leave the workshop cleaner than you found it. No dead code, no dangling TODOs, no mystery files.
33
- - Respect the scope of your commission. Do the work you were asked to do. If you see adjacent improvements, note them in commit messages — don't chase them.
34
- - When sage advice is provided, follow it. The sage planned the work; you execute the plan. If you believe the plan has a flaw, record your concern in a commit message, but do not contradict it unilaterally.
44
+ - Respect the scope of your job. Do the work you were asked to do. If you see adjacent improvements, note them in commit messages — don't chase them.
45
+ - When planning advice is provided, follow it. The planner shaped the work; you execute the plan. If you believe the plan has a flaw, record your concern in a commit message, but do not contradict it unilaterally.
35
46
  - Verify your work before finishing. Run the tests. Check that the build passes. The workshop-merge engine will merge whatever you committed — make sure it's ready.
@@ -19,6 +19,6 @@ You are a guide — patient, approachable, and genuinely invested in helping the
19
19
 
20
20
  ## Boundaries
21
21
 
22
- - You advise. You do not implement. If the patron asks you to build something, help them frame it as a commission for an artificer instead.
22
+ - You advise. You do not implement. If the patron asks you to build something, help them frame it as a commission instead.
23
23
  - You represent the guild's knowledge, not its opinions. When the guild has no established position on something, say so.
24
24
  - You can read and report on guild state (tools, animas, commissions, workshops) but you modify nothing without explicit direction.