@lumoai/cli 1.11.0 → 1.17.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 (30) hide show
  1. package/README.md +13 -13
  2. package/assets/skill/SKILL.md +111 -0
  3. package/assets/skill/references/artifacts-figma.md +124 -0
  4. package/assets/skill/references/docs.md +306 -0
  5. package/assets/skill/references/memory.md +69 -0
  6. package/assets/skill/references/milestones.md +244 -0
  7. package/assets/skill/references/onboarding.md +102 -0
  8. package/assets/skill/references/sessions.md +142 -0
  9. package/assets/skill/references/sprints.md +157 -0
  10. package/assets/skill/references/task-context.md +109 -0
  11. package/assets/skill/references/tasks.md +205 -0
  12. package/dist/cli/src/commands/milestone-archive.js +60 -0
  13. package/dist/cli/src/commands/milestone-list.js +24 -5
  14. package/dist/cli/src/commands/milestone-move.js +84 -0
  15. package/dist/cli/src/commands/milestone-reorder.js +72 -0
  16. package/dist/cli/src/commands/milestone-show.js +35 -0
  17. package/dist/cli/src/commands/milestone-unarchive.js +60 -0
  18. package/dist/cli/src/commands/session-wrap.js +5 -2
  19. package/dist/cli/src/commands/setup.js +50 -22
  20. package/dist/cli/src/commands/sprint-show.js +32 -3
  21. package/dist/cli/src/commands/task-context.js +4 -0
  22. package/dist/cli/src/commands/task-update.js +12 -4
  23. package/dist/cli/src/commands/wrap/blocked-prompt-section.js +64 -0
  24. package/dist/cli/src/index.js +31 -2
  25. package/dist/cli/src/lib/failure-summary-api.js +43 -0
  26. package/dist/cli/src/lib/hook-runner.js +1 -0
  27. package/dist/cli/src/lib/milestone-reorder.js +92 -0
  28. package/dist/cli/src/lib/resolve.js +17 -6
  29. package/package.json +1 -1
  30. package/assets/skill.md +0 -1333
@@ -0,0 +1,69 @@
1
+ # Memory Management
2
+
3
+ ## Memory management
4
+
5
+ Record and curate the long-term Memory that Claude reads on future sessions.
6
+ Memories are scoped **TASK** (useful only for one task) or **PROJECT** (useful
7
+ across the whole project). Automated extraction (layer1) and promotion (layer2,
8
+ on task→done) already run; these commands are the manual override.
9
+
10
+ ### Commands
11
+
12
+ ```bash
13
+ # List
14
+ lumo task memory list [LUM-N] [--category trap|decision|convention|procedural] [-n N]
15
+ lumo project memory list [<project>] [--category ...] [-n N]
16
+
17
+ # Add (per-category fields; <task>/<project> default to the session-bound task)
18
+ lumo task memory add [LUM-N] --category trap --trigger "..." --outcome "..." [--workaround "..."] [--agent <agent>]
19
+ lumo task memory add [LUM-N] --category decision --what "..." --why "..." [--alternatives "..."] [--implications "..."] [--agent <agent>]
20
+ lumo task memory add [LUM-N] --category convention --rule "..." --applies "..." [--agent <agent>]
21
+ lumo task memory add [LUM-N] --category procedural --workflow "..." --trigger "..." [--step "..." --step "..."] [--agent <agent>]
22
+ lumo project memory add [<project>] --category ... [--agent <agent>] # same flags; records at PROJECT scope
23
+
24
+ # --agent values: claude-code | codex | cursor | gemini-cli | github-copilot | windsurf (default claude-code)
25
+ # Aliases: gemini → gemini-cli, copilot → github-copilot (case-insensitive)
26
+ # Omitting --agent records the memory as produced by Claude Code.
27
+
28
+ # Single-memory ops (memoryId from `... memory list` column 1)
29
+ lumo memory promote <memoryId> # TASK → PROJECT
30
+ lumo memory rm <memoryId> --yes # hard delete
31
+ ```
32
+
33
+ When the session is bound (`lumo session attach <LUM-N>`), omit the identifier:
34
+ `lumo task memory add --category trap --trigger ... --outcome ...` records onto
35
+ the bound task; `lumo project memory add ...` records onto its project.
36
+
37
+ ### When to record a memory (worthiness)
38
+
39
+ Record only knowledge that is **invisible in the codebase** — the _why_ behind a
40
+ choice, a gotcha that only surfaces at runtime, a rule that lives in people's
41
+ heads, a non-obvious failure cause, a non-trivial workflow. **Skip** routine work
42
+ (reading files, plain edits, normal git, successful builds) and anything a
43
+ developer could learn from the source, git log, or docs. When unsure, don't.
44
+
45
+ ### Which category
46
+
47
+ - `trap` — a pitfall. Describe the PROBLEM ONLY (`--trigger`, `--outcome`); put any fix in a separate `procedural`.
48
+ - `decision` — an engineering decision (`--what` + `--why`, optional `--alternatives`/`--implications`).
49
+ - `convention` — a team rule (`--rule` + `--applies` = where it applies).
50
+ - `procedural` — a reusable workflow (`--workflow` + `--trigger` + `--step`…).
51
+
52
+ ### TASK vs PROJECT (at add time)
53
+
54
+ Default to **TASK** (`lumo task memory add`). Record directly to **PROJECT**
55
+ (`lumo project memory add`) only when it helps _any_ task in the project: a
56
+ toolchain/environment trap, a team-wide convention, a cross-task decision. When
57
+ unsure → TASK.
58
+
59
+ ### When to promote (TASK → PROJECT)
60
+
61
+ `lumo memory promote <id>` only when the lesson **recurs across 2+ different
62
+ tasks**, would help a _different_ task, and no equivalent PROJECT memory exists.
63
+ A wrong promotion is costly (every agent sees it forever) — prefer leaving it at TASK.
64
+
65
+ ### When to reach for this
66
+
67
+ After a non-trivial debugging session, a pitfall you hit, or establishing a
68
+ convention → consider `lumo task memory add`. When you notice a lesson recurring
69
+ across multiple tasks → consider `lumo memory promote`.
@@ -0,0 +1,244 @@
1
+ # Projects & Milestones
2
+
3
+ ### `lumo project list` — list projects in the workspace
4
+
5
+ Prints `<slug> <Display Name>` lines. The slug column matches the `--project <ref>` argument accepted by `task create`, so users (and you) can copy a slug straight from this output into a create command.
6
+
7
+ ```bash
8
+ lumo project list
9
+ ```
10
+
11
+ ### `lumo milestone list [--project <ref>] [--archived] [--all] [--search <text>]` — list milestones in a project
12
+
13
+ Prints fixed-width rows: `<STATUS> <HEALTH> <target-date or -> <name>`, sorted by target date asc (nulls last) then created asc.
14
+
15
+ By default, only **non-archived** milestones are listed. Use `--archived` to show **only** archived milestones, or `--all` to show **both** archived and non-archived. Archived rows are marked with a ` (archived)` suffix on the name.
16
+
17
+ Use `--search <text>` to filter to milestones whose **name or description** contains the text (case-insensitive substring match). It applies **on top of** the archive filter (e.g. `--all --search q3`). A blank/whitespace-only value is ignored (no filtering). The matched text is bounded to 120 chars server-side.
18
+
19
+ | Flag | Type | Notes |
20
+ | ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
21
+ | `--project <ref>` | string | Required when the workspace has more than one project. Name or slug, case-insensitive. |
22
+ | `--archived` | boolean | Show **only** archived milestones (instead of the default non-archived set). |
23
+ | `--all` | boolean | Show **both** archived and non-archived milestones. |
24
+ | `--search <text>` | string | Filter by **name/description** case-insensitive substring. Combines with the archive filter; blank value ignored. |
25
+
26
+ `HEALTH` is the target-date risk light, server-computed from the milestone's target date + task progress:
27
+
28
+ - `ON-TRACK` — on schedule (or all tasks done)
29
+ - `AT-RISK` — completion lags elapsed time, or (no start date) the target is within ~7 days with work remaining
30
+ - `OVERDUE` — past the target date with tasks still open
31
+ - `-` — no light applies (status `COMPLETED`/`CANCELLED`, or no target date)
32
+
33
+ ```bash
34
+ lumo milestone list # one-project workspace (non-archived only)
35
+ lumo milestone list --project lumo # multi-project workspace
36
+ lumo milestone list --archived # only archived milestones
37
+ lumo milestone list --all # archived + non-archived (archived marked "(archived)")
38
+ lumo milestone list --search q3 # name/description contains "q3" (case-insensitive)
39
+ lumo milestone list --all --search launch # search across archived + non-archived
40
+ ```
41
+
42
+ `--project <ref>` is required when the workspace has more than one project (consistent with `task create --project`). Match is by project name or slug, case-insensitive.
43
+
44
+ ### When to suggest `milestone list`
45
+
46
+ - Before suggesting `task create --milestone <ref>` or `task update --milestone <ref>` to confirm the milestone exists under the expected name.
47
+ - When the user asks "what milestones do we have", "what's on v1.0", or similar.
48
+ - When the user wants to **find/search milestones by keyword** ("find the launch milestone", "搜索里程碑", "which milestones mention X") — use `--search <text>` rather than listing all and eyeballing.
49
+
50
+ When to suggest: before `task create --project <ref>` when the workspace has more than one project and the user hasn't specified which one.
51
+
52
+ ### `lumo milestone create <name>` — create a milestone
53
+
54
+ | Flag | Type | Notes |
55
+ | ---------------------- | ------ | --------------------------------------- |
56
+ | `--project <ref>` | string | Required when workspace has >1 project. |
57
+ | `-d, --description <>` | string | Optional. |
58
+ | `--start <date>` | string | YYYY-MM-DD. |
59
+ | `--target <date>` | string | YYYY-MM-DD. |
60
+
61
+ Examples:
62
+
63
+ ```bash
64
+ lumo milestone create "Q3 Launch"
65
+ lumo milestone create "Q3 Launch" --start 2026-06-01 --target 2026-08-31
66
+ ```
67
+
68
+ On success: `Created milestone "Q3 Launch" <id>`.
69
+
70
+ ### `lumo milestone show <identifier>` — show milestone detail + tasks
71
+
72
+ Accepts UUID or name. With a name, `--project <ref>` is required when the workspace has >1 project.
73
+
74
+ Prints a key:value header (name, status, **health**, dates, project, description), task counts, and the full task table under the milestone. The `Health:` line shows the same target-date risk light as `milestone list` (`ON-TRACK` / `AT-RISK` / `OVERDUE`, or `-` when none applies).
75
+
76
+ It also prints a **Sprint coverage** section (above the task table) listing which
77
+ sprints the milestone's tasks span — each row shows the sprint number, status, name,
78
+ and `done/total` progress — plus an `未排期` line counting milestone tasks not in any
79
+ sprint (shown only when there are any). The section is derived from the milestone's
80
+ tasks (no schema relation), so it needs no extra flags. When no task is in any sprint
81
+ it prints `Sprint coverage: (no sprint coverage)`.
82
+
83
+ Example coverage section:
84
+
85
+ ```
86
+ Sprint coverage:
87
+ #3 ACTIVE Sprint 3 4/6 done
88
+ #4 DRAFT Sprint 4 0/2 done
89
+ 未排期 1 task
90
+ ```
91
+
92
+ ```bash
93
+ lumo milestone show "Q3 Launch"
94
+ lumo milestone show 11111111-2222-3333-4444-555555555555
95
+ ```
96
+
97
+ ### `lumo milestone update <identifier>` — patch a milestone
98
+
99
+ | Flag | Type | Notes |
100
+ | ---------------------- | ------ | ---------------------------------------------------------------- |
101
+ | `--project <ref>` | string | Required when identifier is a name and workspace has >1 project. |
102
+ | `-n, --name <text>` | string | Cannot be empty. |
103
+ | `-d, --description <>` | string | `--description ""` clears. |
104
+ | `-s, --status <value>` | enum | `planned \| active \| completed \| cancelled`. |
105
+ | `--start <date>` | string | `--start ""` clears. |
106
+ | `--target <date>` | string | `--target ""` clears. |
107
+
108
+ At least one field required.
109
+
110
+ ```bash
111
+ lumo milestone update "Q3 Launch" --status active
112
+ lumo milestone update "Q3 Launch" --target 2026-09-15
113
+ lumo milestone update "Q3 Launch" --description ""
114
+ ```
115
+
116
+ ### `lumo milestone delete <identifier>` — delete a milestone
117
+
118
+ Requires `--yes`. No interactive prompt — CLI is agent-friendly. Tasks under the milestone keep their data; their `milestoneId` is cleared.
119
+
120
+ ```bash
121
+ lumo milestone delete "Q3 Launch" --yes
122
+ ```
123
+
124
+ ### `lumo milestone archive <identifier>` — soft-archive a milestone
125
+
126
+ Soft-archives a milestone by setting `archivedAt`. The milestone is **hidden from `milestone list` by default** (use `--archived` or `--all` to see it), but its **history and task links are preserved**, and the action is **reversible** via `milestone unarchive`. This is distinct from `milestone delete`, which is a **hard delete**. While archived, the milestone **rejects edits** (`milestone update`) and **new task bindings** (`task --milestone`, `milestone add`) with a 409 until it is restored. `<identifier>` accepts a UUID or name; `--project <ref>` is required when the identifier is a name and the workspace has >1 project.
127
+
128
+ ```bash
129
+ lumo milestone archive "Q3 Launch"
130
+ lumo milestone archive 11111111-2222-3333-4444-555555555555
131
+ ```
132
+
133
+ ### `lumo milestone unarchive <identifier>` — restore an archived milestone
134
+
135
+ Restores an archived milestone by clearing `archivedAt`. It reappears in `milestone list` and can be edited and bound to tasks again. Idempotent — unarchiving an already-active milestone is a no-op. Same identifier / `--project` rules as `milestone archive`: `<identifier>` accepts a UUID or name; `--project <ref>` is required when the identifier is a name and the workspace has >1 project.
136
+
137
+ ```bash
138
+ lumo milestone unarchive "Q3 Launch"
139
+ ```
140
+
141
+ ### `lumo milestone add <identifier> <task...>` — bind tasks to a milestone (batch)
142
+
143
+ Binds **one or more** tasks to a milestone in a single call — the batch counterpart of `task update --milestone <ref>` (which only takes one task at a time). `<identifier>` accepts a milestone name or UUID; each `<task>` accepts `LUM-N` or a task UUID. `--project <ref>` is required when the identifier is a name and the workspace has >1 project.
144
+
145
+ Task refs are deduped (case-insensitive, order preserved). Each task is PATCHed independently — **partial failures do not roll back**: a task that fails (e.g. not found, or its project has no milestone of that name) is reported on its own line while the rest still bind. Exit code is non-zero if **any** task failed.
146
+
147
+ ```bash
148
+ lumo milestone add "Q3 Launch" LUM-1 LUM-2 LUM-3
149
+ lumo milestone add 11111111-2222-3333-4444-555555555555 LUM-1 LUM-2
150
+ ```
151
+
152
+ Output — a tally header (zero categories omitted) plus one line per task:
153
+
154
+ ```
155
+ Q3 Launch: 2 added, 1 failed
156
+ ✓ LUM-1
157
+ ✓ LUM-2
158
+ ✗ LUM-3 no milestone matches "Q3 Launch" in this project. Try `lumo milestone list`.
159
+ ```
160
+
161
+ ### `lumo milestone remove <identifier> <task...>` — unbind tasks from a milestone (batch)
162
+
163
+ Unbinds **one or more** tasks from a milestone in one call. A task that is **not currently in this milestone is skipped** (idempotent) — it is never reassigned away from a different milestone. `<identifier>` accepts a name or UUID; each `<task>` accepts `LUM-N` or a task UUID. `--project <ref>` is required when the identifier is a name and the workspace has >1 project.
164
+
165
+ ```bash
166
+ lumo milestone remove "Q3 Launch" LUM-1 LUM-5
167
+ ```
168
+
169
+ Output — `✓` removed, `-` skipped (not in milestone), `✗` failed:
170
+
171
+ ```
172
+ Q3 Launch: 1 removed, 1 skipped
173
+ ✓ LUM-1
174
+ - LUM-5 not in this milestone
175
+ ```
176
+
177
+ ### When to suggest `milestone add` / `milestone remove`
178
+
179
+ - The user wants to attach/detach **several** tasks to a milestone at once ("挂这几个任务到 Q3", "把 LUM-1 LUM-2 LUM-3 都放进里程碑", "remove these from the milestone"). For a single task, `task update --milestone <ref>` (or `--milestone ""` to clear) is equally fine.
180
+ - `remove` only clears the binding for tasks actually in the named milestone, so it's safe to pass a broad list — anything not in it is reported as skipped, not clobbered.
181
+ - For one-at-a-time sprint binding see `lumo sprint add / remove` (sprint batch is not yet supported).
182
+
183
+ ### `lumo milestone summary <identifier> [--retry]` — fetch AI-generated milestone retro
184
+
185
+ Prints the AI-generated retrospective summary for a milestone (mirrors `sprint summary`). `<identifier>` accepts a milestone name or UUID; `--project <ref>` is required when the identifier is a name and the workspace has more than one project. When no summary exists yet the command prints `(no summary generated yet)`.
186
+
187
+ A summary is generated automatically when a milestone transitions to `COMPLETED` (e.g. via `lumo milestone update <id> --status completed`). The generated report has sections `## Summary`, `## Delivered`, `## Outstanding` plus a one-line `tldr`. Use `--retry` to queue regeneration (e.g. after a failed generation) before fetching — regeneration is async, so the printed result may still be the previous summary or `(no summary generated yet)`.
188
+
189
+ | Flag | Type | Notes |
190
+ | ----------------- | ------- | ------------------------------------------------------------------------------------------------------ |
191
+ | `--project <ref>` | string | Project name or slug. Required when identifier is a name and the workspace has >1 project. |
192
+ | `--retry` | boolean | Queue a regeneration (async, server returns 202) before fetching. Only valid on a COMPLETED milestone. |
193
+
194
+ ```bash
195
+ lumo milestone summary "Q3 Launch"
196
+ lumo milestone summary "Q3 Launch" --retry
197
+ lumo milestone summary 11111111-2222-3333-4444-555555555555
198
+ ```
199
+
200
+ When to suggest: user asks "summarize the milestone", "milestone retro", "give me a summary of the Q3 milestone", "里程碑总结", "里程碑复盘".
201
+
202
+ ### `lumo milestone reorder <ref...> [--project <ref>]` — set the full milestone order
203
+
204
+ Reorders a project's milestones. Pass **every** milestone in the project (by name, case-insensitive, or its cuid) in the desired order — the command rewrites each milestone's `sortOrder` to match. An incomplete list (not every milestone named), an unknown ref, or a duplicate is rejected **before any network mutation**, with a message naming the offending / missing milestones.
205
+
206
+ ```bash
207
+ lumo milestone reorder "Q3 Launch" "Beta" "Alpha"
208
+ lumo milestone reorder "Q3 Launch" "Beta" "Alpha" --project backend
209
+ ```
210
+
211
+ `--project <ref>` is required when the workspace has more than one project.
212
+
213
+ Output:
214
+
215
+ ```
216
+ Reordered 3 milestones:
217
+ 1. Q3 Launch
218
+ 2. Beta
219
+ 3. Alpha
220
+ ```
221
+
222
+ ### `lumo milestone move <ref> --before <ref> | --after <ref> [--project <ref>]` — move one milestone
223
+
224
+ Moves a single milestone immediately before or after a target milestone, leaving the rest in their current relative order. `--before` and `--after` are **mutually exclusive and exactly one is required** (the CLI errors before any network call if both or neither is given). Refs resolve by cuid or case-insensitive name.
225
+
226
+ ```bash
227
+ lumo milestone move "Alpha" --before "Q3 Launch"
228
+ lumo milestone move "Alpha" --after "Beta" --project backend
229
+ ```
230
+
231
+ Output:
232
+
233
+ ```
234
+ Moved "Alpha" before "Q3 Launch". New order:
235
+ 1. Alpha
236
+ 2. Q3 Launch
237
+ 3. Beta
238
+ ```
239
+
240
+ Both commands resolve to a full ordered list client-side and call the same `PATCH /api/projects/<id>/milestones/reorder` endpoint (which requires the list to name every milestone exactly once). New milestones created via `milestone create` are appended to the bottom of the order.
241
+
242
+ **Ambiguous names:** milestone names are not unique within a project (only the slug is). A ref whose name matches more than one milestone is **rejected** with an `ambiguous milestone name … re-run with the id` error listing the candidate cuids — pass the cuid instead. This applies to every name-based milestone ref (`reorder`, `move`, and also `show` / `update` / `delete` / `summary` / `add` / `remove`).
243
+
244
+ When to suggest: user asks to "reorder milestones", "排序里程碑", "调整里程碑顺序", "move milestone X before/after Y", "把里程碑 X 移到 Y 前面/后面", "put this milestone first".
@@ -0,0 +1,102 @@
1
+ # Onboarding, Authentication & Self-Update
2
+
3
+ ## Onboarding
4
+
5
+ ### `lumo setup [--user|--project] [--force] [--agent <token>]` — install skill + hooks
6
+
7
+ Bootstraps Lumo into a coding-agent installation. Copies the bundled skill files (`SKILL.md` **and its `references/` directory**) into `<scope>/.claude/skills/lumo/` and idempotently merges 25 hook entries into `<scope>/.claude/settings.json`. Existing user permissions and non-Lumo hook entries are preserved.
8
+
9
+ On `--project` scope, setup also installs a `prepare-commit-msg` git hook that
10
+ auto-appends the branch's task ID (`[LUM-N]`, parsed from a `lumo/LUM-N-...`
11
+ branch name) to any commit subject that lacks it. The hook is pure sh + git
12
+ (no network, no `lumo` call) and is merged idempotently between
13
+ `# >>> lumo prepare-commit-msg >>>` / `# <<< lumo <<<` markers, preserving any
14
+ existing hook content. When `core.hooksPath` is set (husky or a custom hooks
15
+ dir), setup does **not** write the file — it prints the block plus instructions
16
+ to add it manually (e.g. to `.husky/prepare-commit-msg`). `--user` scope does
17
+ not touch git hooks.
18
+
19
+ `--agent <token>` records which coding agent these hooks run under and is **baked into every hook command** (`lumo hook <slug> --agent <token>`). Each hook then sends the agent to the server, where it's stored on the Session and inherited by auto-sedimented memories — so a memory is attributed to the agent that produced it instead of the default. Valid tokens: `claude-code | codex | cursor | gemini-cli | github-copilot | windsurf` (case-insensitive; `gemini` and `copilot` are accepted aliases). **Defaults to `claude-code`.** Re-running setup with a different `--agent` rewrites the token in place (no duplicate hook entries), and a legacy flagless entry is upgraded on the next run.
20
+
21
+ ```bash
22
+ npx @lumoai/cli setup # interactive: prompts user/project; agent=claude-code
23
+ npx @lumoai/cli setup --user # write to ~/.claude/
24
+ npx @lumoai/cli setup --project # write to ./.claude/
25
+ npx @lumoai/cli setup --force # overwrite skill files if they differ from bundled
26
+ npx @lumoai/cli setup --agent codex # bake agent=codex into the hook commands
27
+ ```
28
+
29
+ Use when:
30
+
31
+ - The user asks "how do I set up lumo", "install the lumo skill", "wire up lumo hooks"
32
+ - A fresh checkout of a project that uses Lumo doesn't have `.claude/skills/lumo/SKILL.md` yet
33
+ - After `npm install -g @lumoai/cli`, before the first `lumo auth login`
34
+ - Wiring Lumo into a non-Claude-Code agent (Codex / Cursor / …) — pass `--agent <token>` so its memories are attributed correctly
35
+
36
+ If stdin is not a TTY (CI, piped invocation), the default scope is `project` and no prompt is shown. An unrecognized `--agent` token aborts before writing anything.
37
+
38
+ ## Authentication
39
+
40
+ ### `lumo auth login` — paste an API key to log in
41
+
42
+ Walks the user through creating an API key in the web app and pasting it back. Opens the browser to the API Keys settings page, then reads the key from stdin (must start with the `lum_` prefix). On success prints `✓ Logged in as <email>` plus workspace + key name.
43
+
44
+ ```bash
45
+ lumo auth login
46
+ ```
47
+
48
+ Use when:
49
+
50
+ - `lumo whoami` reports "Not logged in"
51
+ - A bearer call returns 401 (`API key invalid or revoked`) and the user wants to re-auth
52
+ - The user switches workspaces / accounts
53
+
54
+ The CLI stores credentials in `~/.lumo/credentials.json`. There's no `--token` flag — the paste-from-browser flow is the only auth path, and that's intentional.
55
+
56
+ ### `lumo auth logout` — remove local credentials
57
+
58
+ Wipes `~/.lumo/credentials.json`. Idempotent — running twice just prints `Not logged in` the second time.
59
+
60
+ ```bash
61
+ lumo auth logout
62
+ ```
63
+
64
+ Use when the user says "log out", "sign out", or wants to clear credentials before switching accounts (then run `lumo auth login` to re-auth).
65
+
66
+ ### `lumo whoami` — show current identity
67
+
68
+ Prints the logged-in email, workspace name + slug, API key name + prefix, and API URL.
69
+
70
+ ```bash
71
+ lumo whoami
72
+ # Logged in as cli@uselumo.ai
73
+ # Workspace: Lumo (lumo)
74
+ # Key: Claude Code (lum_68d4...)
75
+ # API: https://www.uselumo.ai
76
+ ```
77
+
78
+ Use when:
79
+
80
+ - The user asks "who am I", "which workspace am I in", "what account is this"
81
+ - You need to disambiguate whether `lumo task list` would hit the user's expected workspace
82
+ - Before suggesting a destructive command on a shared machine — confirm the identity is right
83
+
84
+ ## Self-Update
85
+
86
+ ### `lumo update` — upgrade the CLI to the latest npm release
87
+
88
+ Synchronously checks `registry.npmjs.org` for the latest published version of `@lumoai/cli`. When a newer version exists, runs `npm install -g @lumoai/cli@latest` and streams npm's output. When already on the latest, exits cleanly with a "Already on the latest version (X)" message.
89
+
90
+ ```bash
91
+ lumo update
92
+ ```
93
+
94
+ The CLI also performs a passive check at most once every 24 hours (a detached child process refreshes a cache at `~/.lumo/update-check.json`), and prints a one-line "Update available" notice on subsequent invocations when a newer version is in the cache.
95
+
96
+ Use when:
97
+
98
+ - The user asks "how do I update", "upgrade lumo", "is there a new version"
99
+ - A bug-fix or feature mentioned in conversation requires a newer CLI than the user is running
100
+ - The passive notice has appeared and the user wants to act on it
101
+
102
+ If `npm install -g` fails (permissions, npm not on PATH, alternative package manager), `lumo update` prints a fallback hint instructing the user to run the install command manually. Do not auto-retry; let the user resolve the environment issue first.
@@ -0,0 +1,142 @@
1
+ # Session Management
2
+
3
+ ## Session Management
4
+
5
+ ### Auto-bind at session start (from local git)
6
+
7
+ When a session starts **without** a bound task, the `session-start` hook tries to
8
+ infer the task from local git before falling back to the "请告诉我任务编号" prompt:
9
+
10
+ - It reads the **current branch name** first (e.g. `lumo/LUM-145-...`), then the
11
+ **most recent commit subjects** (e.g. `... [LUM-145]`), extracting the first
12
+ `LUM-<n>`.
13
+ - On a hit it binds the session to that task automatically (same `bind-task`
14
+ endpoint as `session attach`) and prints a single line:
15
+ `已自动绑定 LUM-145 - <title>(依据分支名/最近 commit)。如果不对,回复"不是"我就帮你解绑。`
16
+ The freshly-bound task's memory is injected too.
17
+ - No match (detached HEAD, a non-lumo branch with no tagged commits, not a git
18
+ repo) or a failed bind (unknown task) → it degrades silently to the normal
19
+ unbound prompt.
20
+
21
+ **Agent guidance:** if the user responds "不是" / "不对" / "wrong task" to an
22
+ auto-bind line, run `lumo session detach` to clear the binding (then `session
23
+ attach <LUM-N>` if they name the right one). No detach is needed when the
24
+ auto-bound task is correct.
25
+
26
+ ### Layer 2 project-memory review at session start
27
+
28
+ When the session is bound, session-start may inject a **"🆕 待核对:上次会话自动合并的项目级记忆"** section alongside the memory / PR-review blocks (LUM-165). It lists the **PROJECT-scope** memories that the member's **immediately-preceding session** auto-consolidated (Layer 2 runs asynchronously when a task is marked `done`). Each item shows its `id`.
29
+
30
+ - **Why it's here:** Layer 2 promotions land async, so they can't be reviewed in the synchronous `session wrap` panel — they're surfaced at the _next_ session-start instead, when they've definitely landed.
31
+ - **Show-once:** the section appears only at the session that immediately follows the one that produced the memories. It does **not** re-nag on later sessions, so act on it now or it scrolls off.
32
+ - **Agent guidance:** briefly sanity-check each listed memory against the codebase/context. If one is wrong or over-generalized, remove it with `lumo memory rm <id> --yes` (ideally confirm with the user first). If they all look right, ignore the section and continue.
33
+
34
+ Attribution requires the CC session id to reach the server: `lumo task update <id> --status done` automatically sends `CLAUDE_CODE_SESSION_ID` (via an `X-Lumo-Session-Id` header) so the resulting Layer 2 memories are attributed to the session. Marking a task done from the **web UI** leaves them unattributed (they won't surface for review) — that's expected.
35
+
36
+ ### `lumo session attach <identifier>` — bind the current session to a task
37
+
38
+ Use this whenever the user mentions a task ID. The command is the only way to bind a session to a task.
39
+
40
+ ```bash
41
+ lumo session attach LUM-42
42
+ ```
43
+
44
+ What it does:
45
+
46
+ - Reads `CLAUDE_CODE_SESSION_ID` from the environment (Claude Code sets this automatically). If it is not set, the command errors out — it must run from inside a Claude Code session.
47
+ - Calls `POST /api/sessions/<session_id>/bind-task` on the Lumo server, which sets the Session row's `taskId` and re-tags previously-untagged HookEvent rows in this session.
48
+ - The binding lives entirely on the server (`Session.taskId`); subsequent hooks read it back via the session row. The CLI keeps no local sentinel.
49
+
50
+ **After attaching, always run `lumo task context <identifier>` to load the task background.**
51
+
52
+ ### Parallel sessions
53
+
54
+ Each Claude Code session has its own `CLAUDE_CODE_SESSION_ID`. Two terminals running `claude code` and binding to different tasks will not interfere with each other — the bindings are scoped per session row server-side.
55
+
56
+ ### `lumo session status` — show current binding
57
+
58
+ Prints which task the current Claude Code session is bound to, or "(no task)" if none. Requires `$CLAUDE_CODE_SESSION_ID` (i.e. must run inside Claude Code).
59
+
60
+ ```bash
61
+ lumo session status
62
+ ```
63
+
64
+ When to suggest: the user asks "which task am I on", "what's this session bound to", or you need to decide whether to suggest `session attach` for a mentioned task ID.
65
+
66
+ ### `lumo session detach` — clear the current binding
67
+
68
+ Idempotent — running it twice is fine, the second call reports `already unbound`. Past hook events keep their original `taskId`; only future events on this session will be untagged.
69
+
70
+ ```bash
71
+ lumo session detach
72
+ ```
73
+
74
+ When to suggest: the user wants to stop tagging the current session with the active task (e.g., switching to unrelated exploratory work without binding to a different task).
75
+
76
+ ### `lumo session wrap [--yes] [--dry-run]` — wrap-up panel: progress comment + memory review + blocked-tag prompt
77
+
78
+ Session-end wrap-up panel with **three sections, run in order**:
79
+
80
+ **1. 进度评论** — reads back the current Claude Code session's per-turn
81
+ `turnSummary` rows (the one-line Chinese summaries written each STOP), aggregates
82
+ every turn **since the last progress comment** into one bulleted body, and — after
83
+ a `[y] 发送 / [e] 编辑 / [s] 跳过` confirmation — posts it as a comment on the
84
+ session's bound task. A server-side watermark (`Session.lastProgressCommentAt`)
85
+ means re-running never re-posts the same turns.
86
+
87
+ **2. 记忆审阅** — lists the Layer1 memories this session sedimented since the
88
+ last review (deduped by a per-session watermark `Session.lastMemoryReviewAt`).
89
+ Each new memory is shown as `[SCOPE] CATEGORY headline`, numbered from 1. You
90
+ curate with a single line: `d 1,3` deletes rows 1 and 3, `p 2` promotes row 2 to
91
+ project scope, and they combine (`d 1,3 p 2`). **回车 (empty) keeps all**; `s`
92
+ skips the section. Keeping all (回车 or `--yes`) still **advances the watermark**
93
+ so the next wrap won't re-list reviewed memories; `s` leaves them for next time.
94
+ Out-of-range indices are ignored. Deletes/promotes run server-side, scoped to
95
+ memories this session created (you can't touch other sessions' memories through
96
+ this panel). With no new memories the section prints "(无内容)" and does nothing.
97
+
98
+ **3. 卡住检测 (blocked-tag prompt, LUM-153)** — if the **same kind of failure
99
+ recurred ≥ 3 times** in this session (server-aggregated from
100
+ `POST_TOOL_USE_FAILURE` events grouped by tool name, plus `STOP_FAILURE`
101
+ turn-level failures), the section surfaces the dominant failure (`卡在 <tool>
102
+ (N 次失败)` + last error summary) and prompts `[y] 标记 / [s] 跳过` whether to
103
+ flag the bound task with a **`blocked` tag**. **Prompt-only — never auto-flips
104
+ status.** It uses a plain tag (no `TaskStatus` enum, no board column, **no
105
+ schema migration**). The prompt is **suppressed** when: there's no bound task,
106
+ the threshold isn't met, or the task **already** carries a `blocked` tag (the
107
+ idempotent gate — there's no watermark, the existing tag is what prevents
108
+ re-nagging). The default on empty input / `s` is **do nothing** (tagging is
109
+ opt-in), so a stray Enter never tags the task. Confirming with an explicit `y`
110
+ attaches the tag idempotently. **`--yes` does NOT auto-tag** — tagging the
111
+ shared board requires an interactive `y`, so `--yes` (and non-TTY) prints the
112
+ suggestion and moves on rather than silently flipping board state. When there's
113
+ nothing to prompt, the section prints "(无内容)".
114
+
115
+ ```bash
116
+ lumo session wrap # interactive: preview each section, choose per-section
117
+ lumo session wrap --yes # progress posted + memories kept; blocked tag NOT auto-applied (needs interactive y)
118
+ lumo session wrap --dry-run # print all drafts only; never posts, never mutates, never advances watermarks
119
+ ```
120
+
121
+ - Requires `$CLAUDE_CODE_SESSION_ID` (must run inside Claude Code) and a bound
122
+ task (`lumo session attach <LUM-N>` first). With no bound task or no new turn
123
+ summaries, the 进度评论 section prints "(无内容)" and posts nothing.
124
+ - `[e] 编辑` (进度评论) opens `$EDITOR` (fallback vi/nano) on the drafted body;
125
+ the edited text is posted and the watermark still advances to the turns the
126
+ draft covered.
127
+ - `--yes` posts the progress comment AND keeps all memories (no
128
+ deletes/promotes) while advancing the memory-review watermark; for the
129
+ blocked-tag section it prints the suggestion but does **not** apply the tag.
130
+ - `--dry-run` prints all drafts; never posts, never mutates memories/tags, never
131
+ advances either watermark.
132
+ - Non-TTY without `--yes`: prints the drafts and does **not** post, mutate, or
133
+ tag (safe default).
134
+
135
+ When to suggest: at the end of a working session on a bound task, to record what
136
+ was done as a progress comment — offer `lumo session wrap` rather than composing
137
+ a `task comment` by hand.
138
+
139
+ ### When to suggest session binding
140
+
141
+ - If the user mentions a task ID (e.g., "let's work on LUM-42") and no session is currently bound, **suggest running `lumo session attach`**.
142
+ - If the user switches tasks mid-session, run `attach` with the new task ID — the server overwrites the existing binding atomically.