@lumoai/cli 1.29.0 → 1.29.1

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,163 @@
1
+ ---
2
+ name: lumo
3
+ description: 'Use the Lumo CLI to work with Lumo (project management for dev teams) from the terminal: load task context, bind/wrap Claude Code sessions, and create/update/list/show/comment on tasks, projects, milestones, sprints, documents, artifacts, Figma links, dependencies, and team memory — plus acceptance criteria, machine verification (verify / task status), lineage audit, worktree scaffolding, and CLI setup/auth/update. Activate when the user mentions a Lumo task identifier (LUM-N) or the lumo CLI, in any language; asks to load task background or bind/check/wrap a session; manages any of the resources above in Lumo; is starting, resuming, or about to claim completion of a task; or asks what to work on next. Key triggers: "LUM-", "lumo", "task context", "session attach", "session wrap", "verify", "task status", "acceptance criteria", "milestone", "sprint", "docs", "memory", "deps", "lineage", "worktree", "design link", "what should I work on", "resume task".'
4
+ ---
5
+
6
+ ## Prerequisites
7
+
8
+ Before running any `lumo` command, verify the CLI is available and authenticated:
9
+
10
+ ```bash
11
+ which lumo && lumo whoami
12
+ ```
13
+
14
+ - If `lumo` is not found: tell the user to install it (`npm install -g @lumoai/cli`; for monorepo dev, `cd cli && npm install && npm link` also works)
15
+ - If `lumo whoami` fails with an auth error: tell the user to run `lumo auth login`
16
+ - Do NOT proceed with any lumo commands until both checks pass
17
+
18
+ ## How this skill is organized
19
+
20
+ The command catalog below is a **map**: it lists every command grouped by domain with a one-line summary. **Detailed flags, examples, output formats, and "when to suggest" guidance live in the `references/` files** — when a user request lands in a domain, **Read the matching reference file before composing the command**. Don't run a command from memory if its flags/edge-cases matter; open the reference first.
21
+
22
+ | Domain | Read this reference |
23
+ | --------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
24
+ | `setup`, `auth login/logout`, `whoami`, `update` | [references/onboarding.md](references/onboarding.md) |
25
+ | `task context`, retrieval (`slack/web/figma context`, `comments list`, `pr show`) | [references/task-context.md](references/task-context.md) |
26
+ | `task create/update/list/show/comment`, `next` | [references/tasks.md](references/tasks.md) |
27
+ | `task artifact*`, `task figma*` | [references/artifacts-figma.md](references/artifacts-figma.md) |
28
+ | `task criteria set/list`, drafting the acceptance contract | [references/criteria.md](references/criteria.md) |
29
+ | `verify`, `task status` — machine verification loop, claim-done flow, self-check/resume | [references/verify.md](references/verify.md) |
30
+ | `project list`, `milestone*` | [references/milestones.md](references/milestones.md) |
31
+ | `doc*` | [references/docs.md](references/docs.md) |
32
+ | `sprint*` | [references/sprints.md](references/sprints.md) |
33
+ | `task/project memory`, `memory promote/rm` | [references/memory.md](references/memory.md) |
34
+ | `session attach/status/detach/wrap`, git-suggest on start, Layer-2 review | [references/sessions.md](references/sessions.md) |
35
+ | `worktree add/rm/list` (local dev tooling) | [references/worktree.md](references/worktree.md) |
36
+
37
+ ## Command catalog
38
+
39
+ **Onboarding / auth / update** — see [onboarding.md](references/onboarding.md)
40
+
41
+ - `lumo setup [--user|--project] [--force] [--agent <token>]` — install skill files + hooks
42
+ - `lumo auth login` / `lumo auth logout` — paste an API key / clear credentials
43
+ - `lumo whoami` — show current identity (email, workspace, key)
44
+ - `lumo update` — upgrade the CLI to the latest npm release
45
+
46
+ **Task context & retrieval** — see [task-context.md](references/task-context.md)
47
+
48
+ - `lumo task context <id>` — load task background (memory, source cards, PR review todos, prior sessions)
49
+ - `lumo task slack show <id> <contextId>` — full stored Slack thread
50
+ - `lumo task web show <id> <linkId>` — fetched web link body
51
+ - `lumo task figma context <id> <linkId>` — Figma link metadata (v1)
52
+ - `lumo task comments list <id>` — full comment thread (read-only; ≠ `task comment`)
53
+ - `lumo task pr show <id> <number>` — synced PR metadata (v1)
54
+ - `lumo task lineage <id>` — show the causal trail: fragments that fed the task + each one's outcome + the run's token/loop cost (read-only audit view); `lumo task lineage <id> --signal` also appends workspace-level usage signal-health (used distribution, per-session variance, used-vs-base merge rate)
55
+
56
+ **Tasks** — see [tasks.md](references/tasks.md)
57
+
58
+ - `lumo task create <title> [flags]` — create a task
59
+ - `lumo task update <id> [flags]` — patch status/title/priority/assignee/milestone/sprint/tags
60
+ - `lumo task list [flags]` — list tasks assigned to you
61
+ - `lumo next [--count N]` — recommend the next task to work on (read-only)
62
+ - `lumo task show <id>` — print one task's detail
63
+ - `lumo task comment <id> <body>` — leave a comment
64
+
65
+ **Task dependencies**
66
+
67
+ - `lumo task deps list <id>` — list dependency edges in both directions, grouped CONFIRMED / SUGGESTED (pending confirmation) / DISMISSED; each row shows a short edge id `[xxxxxxxx]`, the other task, and detected evidence (`shared_files(N shared files: …)` / `task_mention(…)`); SUGGESTED rows include a copy-pasteable confirm hint
68
+ - `lumo task deps add <id> --blocked-by <LUM-N>` — declare a manual hard dependency (created CONFIRMED, source MANUAL; if a SUGGESTED/DISMISSED edge already exists in the same direction, it is confirmed in place rather than creating a new row)
69
+ - `lumo task deps confirm <id> <edge> [--reverse]` — confirm a detected candidate; `<edge>` is a short edge-id prefix (≥6 chars) or the other task's identifier (case-insensitive); `--reverse` flips the direction when the detector guessed it backwards
70
+ - `lumo task deps dismiss <id> <edge>` — dismiss a candidate (never re-suggested)
71
+ - `lumo task deps rm <id> <edge> --yes` — delete an edge (refuses without `--yes`)
72
+ - On an ambiguous/unknown `<edge>` selector the CLI prints all candidates with short ids and exits 1 — retry with one of them
73
+
74
+ **Acceptance criteria (contract)** — see [criteria.md](references/criteria.md)
75
+
76
+ - `lumo task criteria set <task> --file <criteria.json> [--human] [--cause <tag>]` — submit the whole contract: default = initial agent draft (AGENT_DRAFT, locked once submitted); `--human` = a HUMAN_EDIT revision transcribed from the conversation (desired final list; items with `id` keep/update, missing ones are deleted); `--cause` (with `--human`) annotates why the contract drifted: `NEW_INFO | SCOPE_CHANGE | DRAFT_BLIND_SPOT | GRANULARITY | OTHER`
77
+ - `lumo task criteria list <task>` — print the contract (id, MACHINE/HUMAN, provenance source@round, checkpointer)
78
+
79
+ **Verification (machine acceptance loop)** — see [verify.md](references/verify.md)
80
+
81
+ - `lumo verify [task] [--timeout <seconds>]` — run every MACHINE criterion's checkpointer locally, report one structured PASS/FAIL verdict per criterion to the server, print next actions. Defaults to the session-bound task. Round cap 3: an all-pass round moves the task to IN_REVIEW (agent stops there); a round-3 fail escalates to a human (stop retrying). **Run this before claiming a task is done.**
82
+ - `lumo task status [task] [--json]` — read-only acceptance self-check (no LLM, milliseconds): the contract with each criterion's latest verdict (REVIEW_ADDED provenance visible), verification history, current round, last round's failure reasons, and `nextActions` = the unmet criteria (the declarative "what's next" — no separate plan). Defaults to the session-bound task; `--json` emits a versioned payload (`version` field). **Run it first when resuming a task in a new session or after a verification round was rejected.**
83
+
84
+ **Artifacts & Figma** — see [artifacts-figma.md](references/artifacts-figma.md)
85
+
86
+ - `lumo task artifact add/update/list/show/rm` — record spec/plan products on a task
87
+ - `lumo task figma add/list/rm/refresh` — attach & manage Figma designs
88
+
89
+ **Projects & milestones** — see [milestones.md](references/milestones.md)
90
+
91
+ - `lumo project list` — list projects (slugs feed `--project`)
92
+ - `lumo milestone list/create/show/update/delete` — milestone CRUD (`show` includes a Sprint-coverage section)
93
+ - `lumo milestone archive/unarchive` — soft-archive / restore
94
+ - `lumo milestone add/remove <id> <task...>` — batch bind/unbind tasks
95
+ - `lumo milestone summary [--retry]` — AI retro
96
+ - `lumo milestone reorder/move` — manual ordering
97
+
98
+ **Documents** — see [docs.md](references/docs.md)
99
+
100
+ - `lumo doc create/update/show/list/delete` — document CRUD; `doc show` prints the body revision, `doc update` takes `--if-revision <n>` (mismatch → 409 conflict, re-read and retry — no silent overwrite)
101
+ - `lumo doc show <doc> --raw` — print the byte-identical markdown source of the last markdown upload (the only legal edit base; errors when no source is stored — never falls back to the lossy HTML→md render)
102
+ - `lumo doc show <doc> --section "<heading>"` — print just one heading-addressed section of the markdown source (byte-faithful slice, subsections included; revision on stderr; prefix `#…` pins depth)
103
+ - `lumo doc patch <doc> --section "<heading>" --content/--file/stdin [--if-revision N]` — replace ONLY that section (heading line included); every byte outside it is untouched; concurrent edits 409 instead of clobbering
104
+ - `lumo doc append <doc> [--section "<heading>"] --content/--file/stdin [--if-revision N]` — append at section end (or doc end without `--section`); pure insertion, no existing byte modified — the safest write for running logs/ledgers
105
+ - `lumo doc diff <doc> --file <local.md>` — compare the server-side markdown source against a local file (exit 0 identical, 1 with unified diff)
106
+ - `lumo doc move` — reparent under a parent / to root
107
+ - `lumo doc bind/unbind <doc> <task>` — task linkage
108
+ - `lumo doc share/unshare/share-list` — member sharing
109
+ - `lumo doc import-gdoc` / `lumo doc sync` — Google Doc import & re-sync
110
+
111
+ **Sprints** — see [sprints.md](references/sprints.md)
112
+
113
+ - `lumo sprint list/create/show/update/delete` — sprint CRUD (`show` includes Progress / Health / Blockers)
114
+ - `lumo sprint start/close` — status transitions (no `--status` flag)
115
+ - `lumo sprint add/remove <id> <task>` — bind/unbind a task
116
+ - `lumo sprint summary [--retry]` — AI retro
117
+
118
+ **Memory** — see [memory.md](references/memory.md)
119
+
120
+ - `lumo task memory add/list` · `lumo project memory add/list` — record/curate Memory (TASK vs PROJECT)
121
+ - `lumo memory promote <id>` / `lumo memory rm <id> --yes` — TASK→PROJECT / delete
122
+
123
+ **Sessions** — see [sessions.md](references/sessions.md)
124
+
125
+ - `lumo session attach <id>` — bind this session to a task (then run `task context`)
126
+ - `lumo session status` / `lumo session detach` — show / clear binding
127
+ - `lumo session wrap [--yes] [--dry-run] [--used <indices>]` — end-of-session panel: progress comment + memory review + fragment-usage vote (`--used`, LUM-300) + blocked-tag prompt. Usage is now also audited automatically when a task reaches DONE (evidence-gated, true-only — confident fragments marked used, the rest left NULL); `session wrap --used` remains the manual override and takes precedence for a session.
128
+ - Git-suggest at session start (suggests `session attach`, never auto-binds) + Layer-2 project-memory review — see the reference
129
+
130
+ **Worktrees (local dev tooling)** — see [worktree.md](references/worktree.md)
131
+
132
+ - `lumo worktree add <LUM-N> [slug]` — scaffold `.worktrees/<LUM-N>` + node_modules symlink off origin/main; run from the main checkout
133
+ - `lumo worktree rm <LUM-N> --yes` — remove a worktree (keeps the branch unless `--delete-branch`)
134
+ - `lumo worktree list` — list `.worktrees/` worktrees (task id, branch, dirty, node_modules link)
135
+
136
+ ## Commands & flags that do NOT exist (common mistakes)
137
+
138
+ Measured from real agent sessions (LUM-392) — don't guess these:
139
+
140
+ - No `lumo session start` — binding is `lumo session attach <LUM-N>`
141
+ - No `lumo task delete` — tasks can't be deleted from the CLI (web UI only)
142
+ - No `lumo task artifact edit` — it's `lumo task artifact update`
143
+ - No `lumo auth status` — identity check is `lumo whoami`
144
+ - No `--body` on `lumo task comment` — the body is a positional arg: `lumo task comment LUM-N "text"`
145
+ - No `--content` on `task/project memory add` — memory is structured fields (`--category` + per-category flags), see [memory.md](references/memory.md)
146
+ - No global `--verbose` flag on any command
147
+ - `lumo task comments list` (plural) **reads** the thread; `lumo task comment` (singular) **writes** one
148
+ - Status updates: `lumo task update LUM-N --status done` is one direct call — do **not** walk `in_progress → in_review → done` step by step (see [tasks.md](references/tasks.md) for the transition matrix; under the verify flow you shouldn't be setting `in_review`/`done` yourself at all)
149
+
150
+ ## Core workflow
151
+
152
+ Typical flow when a user says "help me with LUM-42":
153
+
154
+ 1. `lumo session attach LUM-42` — bind this session
155
+ 2. `lumo task context LUM-42` — load background
156
+ 3. Review unresolved items, PR-review todos, and the task description
157
+ 4. **If the task has no acceptance criteria** (context shows the draft reminder instead of a contract): draft outcome-level criteria sized to the task (3–7 for a typical multi-file task; 1–2 for a micro task) and submit them with `lumo task criteria set` **before writing the first line of code** — see [criteria.md](references/criteria.md) for the drafting guide
158
+ 5. Begin working on the task
159
+ 6. **Before claiming the work is done: run `lumo verify`** — the machine half of the acceptance loop. Fix failures and re-run (round cap 3). On all-pass the task moves to IN_REVIEW and you stop; never set DONE yourself after a verify loop — that adjudication is human-only. See [verify.md](references/verify.md)
160
+
161
+ **Status-first recovery:** when you pick a task back up — a new session resuming earlier work, or a task that came back after a rejected verification round / review findings — run `lumo task status` **before** re-reading code or planning. It tells you where the loop stands (current round, what passed, what's unmet and why, any REVIEW_ADDED criteria appended during review) so you don't redo finished work or miss the reason it bounced. See [verify.md](references/verify.md)
162
+
163
+ **Git-suggest at start:** when the session is unbound, session-start may infer the task from the git branch / recent commits (any team prefix, e.g. `SPEC-12`, not just `LUM-N`) and print a suggestion — `Detected LUM-N (from branch name). Run lumo session attach LUM-N to bind.` (or `from recent commits`) — **without** binding. Confirm it's the right task, then run `lumo session attach <LUM-N>` yourself (binding only happens on an explicit attach). See [sessions.md](references/sessions.md) for the full session-start behavior.
@@ -0,0 +1,124 @@
1
+ # Task Artifacts & Figma Designs
2
+
3
+ ### Task ↔ Spec Artifacts
4
+
5
+ Record Claude Code spec-engineering products (spec / plan / design …) on a task. The artifacts show up in the task detail definition ("spec") layer and are injected into `lumo task context`.
6
+
7
+ #### `lumo task artifact add <task> --kind <kind> --title <title> --file <path> --source <source> --agent <agent>`
8
+
9
+ Attaches an artifact to a task. `--kind`, `--title`, `--source` are stored verbatim — **`kind` is opaque** (no enumeration; `spec` / `plan` / `requirements` / anything is accepted). `--source` is **required** and names the spec-generation framework that produced the artifact, written as its **formal name** (`Superpowers` / `Spec Kit` / `BMad` / `OpenSpec` / `GSD` / …) — it is also opaque (no enumeration), but there is **no default**, so you must pass it. Quote names that contain spaces (`--source "Spec Kit"`). `--file` supplies the body (file contents). Each call appends to the end of the task's artifact list — call once per artifact (e.g. Superpowers: one `spec`, one `plan`). The `<task>` (e.g. `LUM-42`) is resolved server-side. **`--file` is sandboxed:** the CLI rejects any path that resolves **outside the current project directory** (parent-traversal, absolute paths, escaping symlinks) or that matches a **sensitive-file denylist** (`.env*`, `id_rsa`/`id_ed25519`, `*.pem`/`*.key`, `.aws`/`.ssh` contents, `credentials`, `.npmrc`, …). There is no override flag — pass only project-local, non-secret files (e.g. `docs/spec.md`). To record an out-of-tree file, copy it into the project first.
10
+
11
+ `--agent` is **required** and names the coding tool that produced the artifact (enum). Valid values: `claude-code | codex | cursor | gemini-cli | github-copilot | windsurf` (case-insensitive; `gemini` and `copilot` are accepted aliases).
12
+
13
+ ```bash
14
+ lumo task artifact add LUM-42 --kind spec --title "Spec" --file docs/spec.md --source Superpowers --agent claude-code
15
+ lumo task artifact add LUM-42 --kind plan --title "Implementation plan" --file docs/plan.md --source "Spec Kit" --agent claude-code
16
+ ```
17
+
18
+ Output: `Added [spec] "Spec" to LUM-42`
19
+
20
+ #### `lumo task artifact update <task> <artifact-id> [--kind <kind>] [--title <title>] [--source <source>] [--agent <agent>]`
21
+
22
+ Patches an existing artifact's metadata in place. Editable fields are **`kind`, `title`, `source`, and `agent`** — **content is immutable** (to change the body, `rm` the artifact and `add` it again). At least one flag is required; passing none errors before any network call. Empty values (`--kind ""`) are rejected. The `<artifact-id>` is the cuid in column 1 of `artifact list`. `--agent` accepts the same valid values and aliases as `artifact add`: `claude-code | codex | cursor | gemini-cli | github-copilot | windsurf` (case-insensitive; `gemini` and `copilot` are accepted aliases).
23
+
24
+ ```bash
25
+ lumo task artifact update LUM-42 cma_xxx --kind plan # re-classify spec → plan
26
+ lumo task artifact update LUM-42 cma_xxx --source "Spec Kit" # fix the framework label
27
+ lumo task artifact update LUM-42 cma_xxx --title "Final spec" --source OpenSpec
28
+ lumo task artifact update LUM-42 cma_xxx --agent cursor # fix the agent label
29
+ ```
30
+
31
+ Output: `Updated [plan] "Final spec" (OpenSpec) on LUM-42`. A 404 (task or artifact missing in this workspace) prints the server message and exits 1.
32
+
33
+ #### `lumo task artifact list <task>`
34
+
35
+ Lists artifacts on the task in order: `<id> <kind> <agent> <source> <title>`. Prints `No artifacts on <task>` when there are none.
36
+
37
+ ```bash
38
+ lumo task artifact list LUM-42
39
+ ```
40
+
41
+ #### `lumo task artifact show <task> <artifact-id>`
42
+
43
+ Prints one artifact's key:value header (id, kind, title, agent, source, order, task) followed by the full content body. The `<artifact-id>` is the cuid in column 1 of `artifact list`.
44
+
45
+ ```bash
46
+ lumo task artifact show LUM-42 cma_xxx
47
+ ```
48
+
49
+ #### `lumo task artifact rm <task> <artifact-id> --yes`
50
+
51
+ Deletes an artifact from a task. Irreversible — `--yes` is required and there is no interactive prompt (agent-friendly). On success prints `Removed <artifact-id> from <task>`. A 404 (task or artifact missing in this workspace) prints the server message and exits 1.
52
+
53
+ ```bash
54
+ lumo task artifact rm LUM-42 cma_xxx --yes
55
+ ```
56
+
57
+ When to suggest: after running a spec/plan workflow in Claude Code, offer to record the product(s) with `task artifact add` (one call per artifact) — always pass `--source` with the framework you used. Use `task artifact list` to see what's already recorded, `task artifact show` to inspect a single artifact's content, `task artifact update` to fix a wrong kind/title/source without re-uploading, and `task artifact rm` to drop one that's wrong or stale.
58
+
59
+ ### Task ↔ Figma Designs
60
+
61
+ #### `lumo task figma add <task> <url>` — attach a Figma file/frame
62
+
63
+ Fetches file name, frame name, and thumbnail via Figma OAuth and stores them
64
+ on the task.
65
+
66
+ ```bash
67
+ lumo task figma add LUM-42 "https://www.figma.com/design/abc123/Onboarding?node-id=1-234"
68
+ ```
69
+
70
+ If the URL omits `node-id`, the link is stored as file-level; the CLI prints
71
+ a `(file-level, thumbnail from "...")` note showing the auto-picked
72
+ representative frame.
73
+
74
+ Idempotent — re-adding the same URL within 7 days returns the existing row
75
+ without re-calling Figma.
76
+
77
+ **Not connected?** Errors with:
78
+
79
+ ```
80
+ ✗ You haven't connected Figma yet.
81
+ Run: open https://www.uselumo.ai/settings/integrations
82
+ ```
83
+
84
+ #### `lumo task figma list <task>` — list attachments
85
+
86
+ ```
87
+ $ lumo task figma list LUM-42
88
+ cfl_xxx1 Onboarding Welcome screen 2026-05-28
89
+ cfl_xxx2 Design System Button / Primary 2026-05-27
90
+ cfl_xxx3 Onboarding (file-level) 2026-05-20 ⚠ thumbnail stale
91
+ ```
92
+
93
+ `⚠ thumbnail stale` appears when `thumbnailFetchedAt > 25 days`.
94
+
95
+ #### `lumo task figma rm <task> <link-id-or-url>` — remove an attachment
96
+
97
+ Accepts a `cfl_*` cuid or the original URL. Idempotent (`Not linked: ...` + exit 0 when no match).
98
+
99
+ #### `lumo task figma refresh <task>` — manual refresh
100
+
101
+ Re-fetches metadata + thumbnail for every Figma link on the task. Per-link
102
+ failures are isolated.
103
+
104
+ ```
105
+ $ lumo task figma refresh LUM-42
106
+ Refreshed 3 Figma links on LUM-42
107
+ ✓ Onboarding · Welcome screen
108
+ ✓ Onboarding · Sign-up form
109
+ ✗ Design System · Button (file not accessible)
110
+ ```
111
+
112
+ ### When to suggest the `task figma` commands
113
+
114
+ - User pastes a Figma URL or mentions a design ("here's the mock", "the
115
+ Figma is at...").
116
+ - User asks "what designs are linked to this task" or "show me the Figma
117
+ for LUM-42".
118
+ - After implementing a UI change, suggest `lumo task figma refresh <task>`
119
+ if the user mentioned updating the Figma source.
120
+
121
+ OAuth connection lives in the Web UI at
122
+ `/settings/integrations`. The CLI does **not** have a `figma auth`
123
+ command; if the user tries `task figma add` without connecting, the error
124
+ message directs them to the Web UI.
@@ -0,0 +1,160 @@
1
+ # Acceptance criteria (contract)
2
+
3
+ The acceptance contract is a small set of structured criteria the task's work
4
+ will be verified against (Acceptance v1, LUM-341/342). The agent drafts it;
5
+ the server validates and stores it; verification rounds (`lumo verify`,
6
+ Slice 1 task #3) judge against it. Criteria are injected at session start and
7
+ in `lumo task context` as the `## Acceptance criteria (contract)` section.
8
+
9
+ ## When to draft — the golden rule
10
+
11
+ **Attach → read context → draft criteria → THEN write the first line of code.**
12
+
13
+ If `lumo task context` / session-start shows the draft reminder ("This task
14
+ has no acceptance criteria yet. …") instead of a
15
+ contract, you MUST draft and submit criteria before starting implementation:
16
+
17
+ 1. Read the task description, comments, linked resources, and memory first —
18
+ the contract distills what "done" means, so understand the task before
19
+ writing it.
20
+ 2. Draft **3–7 criteria** for a typical multi-file task (soft range — the
21
+ server warns outside it but never rejects; if you genuinely need more,
22
+ merge related checks instead). **Scale the count down for small tasks** —
23
+ see "Scale the contract to the task size" below.
24
+ 3. Submit with `lumo task criteria set <task> --file <criteria.json>`.
25
+ Submission **locks the contract for agent edits** — get it right before
26
+ submitting, because afterwards only human revisions (`--human`) can change it.
27
+
28
+ Once you (the agent) have started work, you can NOT change your own contract.
29
+ That's by design: the contract is what your work gets judged against, not a
30
+ to-do list you trim to fit what you built.
31
+
32
+ ## Scale the contract to the task size
33
+
34
+ The 3–7 range is calibrated for typical multi-file tasks. The criterion count
35
+ must track the size of the work — it is not a fixed ritual:
36
+
37
+ - **Micro task** (expected to fit a single session, blast radius of one or
38
+ two files — a docs tweak, a copy change, a small targeted fix): **1–2
39
+ criteria IS a complete contract** — one targeted MACHINE criterion plus at
40
+ most one HUMAN criterion.
41
+ - **Never pad toward the soft floor.** A filler criterion (a restated
42
+ baseline, a third angle on the same check) dilutes the contract and taxes
43
+ every verification round. For a micro task the below-minimum warning is
44
+ expected — ignore it.
45
+ - **Shrink the contract, never skip it.** Every task still drafts and locks a
46
+ contract before the first line of code; task size only changes how many
47
+ criteria that takes.
48
+
49
+ ## How to write good criteria
50
+
51
+ - **Outcome-level definition of done, not micro-steps.** A criterion states a
52
+ verifiable result ("`lumo task criteria set` rejects a second agent draft
53
+ with 409"), not a task step ("add a check in the service").
54
+ - **Repo-wide baselines don't take slots.** Tests pass / `tsc --noEmit` clean /
55
+ i18n locale parity / lint are already required by the repo's PR checklist —
56
+ never spend one of your 3–7 criteria on them.
57
+ - **MACHINE vs HUMAN:**
58
+ - `MACHINE` = an executable check exists. It **must** carry a `checkpointer`
59
+ (the runnable check: a test command, script, probe…). The checkpointer
60
+ runs on the agent's machine; the structured verdict is reported back to
61
+ the server (execution on the client, adjudication on the server).
62
+ - `HUMAN` = needs human judgment (UX feel, copy tone, design fidelity).
63
+ - **If you can't attach a checkpointer to a MACHINE criterion, demote it to
64
+ HUMAN** — the server rejects checkpointer-less MACHINE criteria rather
65
+ than silently rewriting them. Don't invent a fake checkpointer to keep it
66
+ MACHINE.
67
+ - `evidenceRequired: true` marks criteria whose verdict must point at proof
68
+ (a MACHINE PASS always requires evidence regardless of this flag).
69
+
70
+ ## JSON file format
71
+
72
+ `criteria.json` is a JSON array; one object per criterion:
73
+
74
+ ```json
75
+ [
76
+ {
77
+ "statement": "PUT /api/tasks/[id]/criteria rejects a second AGENT_DRAFT submission with 409",
78
+ "verifierType": "MACHINE",
79
+ "checkpointer": "npx jest __tests__/task-criteria.service.test.ts -t 'agent lock'"
80
+ },
81
+ {
82
+ "statement": "The criteria section reads naturally as part of the task statement",
83
+ "verifierType": "HUMAN"
84
+ },
85
+ {
86
+ "statement": "Session-start injection shows the contract ahead of memory",
87
+ "verifierType": "MACHINE",
88
+ "checkpointer": "npx jest __tests__/cli/hook-runner-session-start-stdout.test.ts",
89
+ "evidenceRequired": true
90
+ }
91
+ ]
92
+ ```
93
+
94
+ Fields: `statement` (required, ≤2000 chars), `verifierType` (`"MACHINE"` |
95
+ `"HUMAN"`), `checkpointer` (required for MACHINE), `evidenceRequired`
96
+ (optional, default false), `id` (only in `--human` revisions — see below).
97
+
98
+ ## Commands
99
+
100
+ ### `lumo task criteria set <task> --file <criteria.json>`
101
+
102
+ Initial agent draft. Creates the whole contract as `AGENT_DRAFT` at round 0.
103
+ Rejected with 409 once **any** criteria exist on the task — the agent lock.
104
+ Echoes the stored criteria (with ids) plus the 3–7 soft-cap warning if
105
+ outside range.
106
+
107
+ ### `lumo task criteria set <task> --file <criteria.json> --human`
108
+
109
+ Record a **human contract revision** (HUMAN_EDIT), e.g. when the user changes
110
+ the contract in conversation — you transcribe their decision. Allowed at any
111
+ time, even after the agent lock. The file is the **desired final list**:
112
+
113
+ - items carrying an `id` (from `criteria list`) keep that criterion — changed
114
+ fields update it and stamp it `HUMAN_EDIT`; identical fields leave it (and
115
+ its provenance) untouched
116
+ - items without `id` are created as `HUMAN_EDIT`
117
+ - existing criteria missing from the file are **deleted** — refused with 409
118
+ if the criterion already has verification runs (reword it instead)
119
+
120
+ The revision is auto-recorded as a task comment with the session origin
121
+ (`X-Lumo-Session-Id`). **Transcribing the contract is allowed; transcribing a
122
+ verdict is never** — human verdicts only enter through human-initiated paths
123
+ (web UI / Slack action), and the agent has no write path to them.
124
+
125
+ Only use `--human` for decisions a human actually made (in conversation, in a
126
+ comment, in review). Never use it to work around your own lock.
127
+
128
+ Optionally annotate **why** the contract drifted with
129
+ `--cause <NEW_INFO|SCOPE_CHANGE|DRAFT_BLIND_SPOT|GRANULARITY|OTHER>` — pick
130
+ the tag from the human's stated reason (new information, scope moved, the
131
+ draft missed it, wrong granularity). The tag lands in the drift record
132
+ (TaskActivity payload), feeding the Slice-3 drift-cause distribution. Every
133
+ criteria add/update/delete is mirrored as a structured `CRITERION_CHANGED`
134
+ activity automatically; `--cause` just enriches it.
135
+
136
+ ### `lumo task criteria list <task>`
137
+
138
+ Print the contract: `<id> [MACHINE|HUMAN] SOURCE@rN [evidence] statement`
139
+ plus an indented `↳ check:` line for checkpointers. Use it to fetch ids
140
+ before a `--human` revision. Empty contract prints a drafting pointer.
141
+
142
+ ## Injection behavior
143
+
144
+ - **Session start** (bound task): the contract is the highest-priority
145
+ section in the injection budget — ahead of memory/PR/Slack/Figma/web. If a
146
+ still-open task has no criteria, the draft reminder is injected instead.
147
+ - **`lumo session attach`**: prints the contract (or the draft reminder) right after
148
+ binding.
149
+ - **`lumo task context`**: the `## Acceptance criteria (contract)` section appears after the
150
+ task description, before memory.
151
+ - Review-time gap findings are appended at the round they surface and show up
152
+ in the contract automatically — `REVIEW_ADDED` provenance via human review
153
+ paths; findings a human raises in conversation are transcribed with
154
+ `--human` + `--cause` (see verify.md "Review-time drift habits").
155
+
156
+ ## After the contract: the verification loop
157
+
158
+ The contract is judged by `lumo verify` — run it before claiming the task is
159
+ done. See [verify.md](verify.md) for the loop (round cap 3, IN_REVIEW on
160
+ all-pass, escalation on a round-3 fail).