levi-gear 0.4.0 → 0.6.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.
- package/README.md +31 -35
- package/docs/README.md +39 -0
- package/docs/authoring-usecases.md +123 -0
- package/docs/cli.md +99 -0
- package/docs/codex.md +23 -0
- package/docs/configuration.md +81 -0
- package/docs/contributing.md +46 -0
- package/docs/customization.md +45 -0
- package/docs/installation.md +82 -0
- package/docs/introduction.md +49 -0
- package/docs/team.md +143 -0
- package/docs/troubleshooting.md +63 -0
- package/docs/unattended-runs.md +49 -0
- package/docs/updating.md +109 -0
- package/docs/usage.md +62 -0
- package/docs/usecases.md +460 -0
- package/package.json +4 -3
- package/src/cli.js +3 -3
- package/src/commands/init.js +20 -25
- package/src/commands/list.js +3 -5
- package/src/commands/status.js +1 -1
- package/src/commands/update.js +4 -4
- package/src/lib/agents.js +1 -1
- package/src/lib/desired-state.js +62 -31
- package/src/lib/sync.js +3 -3
- package/src/lib/tools.js +10 -81
- package/src/runtime/codex-checkpoint.mjs +48 -0
- package/src/runtime/quota-check.mjs +21 -142
- package/usecases/_run-rules.md +13 -20
- package/usecases/brainstorming/SKILL.md +0 -4
- package/usecases/code-review/SKILL.md +0 -4
- package/usecases/create-feature/SKILL.md +3 -4
- package/usecases/create-feature/scripts/lock-tests.mjs +21 -8
- package/usecases/design/SKILL.md +0 -4
- package/usecases/fix-bug/SKILL.md +3 -4
- package/usecases/generate-test-scenarios/SKILL.md +0 -5
- package/usecases/spec-writing/SKILL.md +0 -4
- package/src/runtime/codex-run-state.mjs +0 -156
- package/usecases/brainstorming/references/codex-runner.md +0 -28
- package/usecases/code-review/references/codex-runner.md +0 -5
- package/usecases/create-feature/references/codex-runner.md +0 -57
- package/usecases/design/references/codex-runner.md +0 -27
- package/usecases/fix-bug/references/codex-runner.md +0 -32
- package/usecases/generate-test-scenarios/references/codex-runner.md +0 -32
- package/usecases/spec-writing/references/codex-runner.md +0 -25
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
|
|
5
|
+
- Node.js 18 or newer
|
|
6
|
+
- A project folder where you use Claude Code or Codex
|
|
7
|
+
|
|
8
|
+
levi is not installed globally. You run it with `npx` from the root of your project.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx levi-gear@latest init
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This installs every usecase in the kit. Run it from the project root: levi writes into the current directory.
|
|
17
|
+
|
|
18
|
+
To install for Codex, use `npx levi-gear@latest init --tools codex`; use
|
|
19
|
+
`--tools claude,codex` for both. See [Codex support](codex.md) for prerequisites
|
|
20
|
+
and recovery limitations.
|
|
21
|
+
|
|
22
|
+
### Choose usecases
|
|
23
|
+
|
|
24
|
+
Name the usecases to install; leave them out to install all.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx levi-gear@latest init brainstorming
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
See which usecases exist with `npx levi-gear@latest list`.
|
|
31
|
+
|
|
32
|
+
## What `init` does
|
|
33
|
+
|
|
34
|
+
1. Reads the kit and validates it, so a broken file fails before anything is written.
|
|
35
|
+
2. Writes:
|
|
36
|
+
- a skill folder per usecase (`levi-<usecase>/`);
|
|
37
|
+
- the generated entry point `levi/`;
|
|
38
|
+
- subagent files for the usecase's own agents and for the five team agents.
|
|
39
|
+
3. Marks every skill as manual-only.
|
|
40
|
+
4. Writes `.levi.json` with the installed usecases and a hash of every file written.
|
|
41
|
+
5. Prints a summary and the invocation syntax.
|
|
42
|
+
|
|
43
|
+
Example output:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
Installed 1 usecase(s) for Claude Code
|
|
47
|
+
- brainstorming
|
|
48
|
+
Added 21, updated 0, removed 0 file(s).
|
|
49
|
+
|
|
50
|
+
Invoke with:
|
|
51
|
+
/levi <request> /levi-<usecase> <request>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The exact file count depends on the kit version. For the full list of paths, see [Configuration and file layout](configuration.md).
|
|
55
|
+
|
|
56
|
+
## Commit the result
|
|
57
|
+
|
|
58
|
+
Commit the generated folders and `.levi.json`. Teammates then get everything by cloning, and `.levi.json` lets anyone run `levi update` later without overwriting local edits.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git add .claude .levi.json
|
|
62
|
+
git commit -m "chore: install levi"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Running `init` again
|
|
66
|
+
|
|
67
|
+
`init` is safe to repeat. It merges with what is installed:
|
|
68
|
+
|
|
69
|
+
- **Add a usecase:** `levi init <usecase>` keeps the usecases you already have and adds the new one.
|
|
70
|
+
- **Files you changed** are never overwritten by `init`. They are reported as kept. Use [`update --force`](updating.md#taking-the-kit-version-of-a-file) to take the kit version.
|
|
71
|
+
- **A path that already exists** and was not written by levi is kept as is and reported as a conflict.
|
|
72
|
+
|
|
73
|
+
## Errors
|
|
74
|
+
|
|
75
|
+
| Message | Cause |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `Unknown tool; choose claude or codex` | An unsupported value was supplied to `--tools`. Nothing is installed. |
|
|
78
|
+
| `Not found in kit: x` | A usecase name does not exist. The other usecases named are still installed; the command exits with code 1. |
|
|
79
|
+
|
|
80
|
+
## Uninstall
|
|
81
|
+
|
|
82
|
+
There is no uninstall command. To remove levi, delete the files it wrote as recorded in `.levi.json`, then remove that configuration file. Depending on the selected targets, managed files live under `.claude/skills/`, `.claude/agents/`, `.agents/skills/` and `.codex/agents/`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
3
|
+
levi is an npm package that installs **Agent Skills** and **subagents** into a project, so that Claude Code can run team workflows. It has no runtime dependencies and needs Node.js 18 or newer.
|
|
4
|
+
|
|
5
|
+
## The pieces
|
|
6
|
+
|
|
7
|
+
| Piece | What it is | Who runs it |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| **Usecase** | A self-contained workflow, written as a skill (`SKILL.md`), optionally with its own subagents and reference files. Example: `brainstorming`. | You, by calling it |
|
|
10
|
+
| **Team agents** | Five shared role agents (PM, teamlead, developer, designer, QA) that usecases delegate to. | A usecase, never you directly |
|
|
11
|
+
| **Entry point** | A generated skill named `levi` that reads your request and runs the best matching usecase. | You, by calling it |
|
|
12
|
+
| **`.levi.json`** | A record of what was installed and a hash of each file, so updates never overwrite your edits. | The CLI |
|
|
13
|
+
|
|
14
|
+
A usecase is the *what*: the steps to follow. The team is the *who*: the roles that carry the steps out. The usecase's skill runs the team by calling each member in turn.
|
|
15
|
+
|
|
16
|
+
## Design principles
|
|
17
|
+
|
|
18
|
+
**Manual only.** levi never runs by itself. Every installed skill is marked so that Claude Code does not trigger it on its own. A prompt that does not start with the levi command is handled by Claude Code as usual.
|
|
19
|
+
|
|
20
|
+
**Built for Claude Code.** You write a usecase once. The installer writes it as a Claude Code skill folder and subagent files.
|
|
21
|
+
|
|
22
|
+
**Your files are yours.** Installed files are plain files in your repository. You can edit them. `levi update` keeps every file you changed and only refreshes the ones you did not touch.
|
|
23
|
+
|
|
24
|
+
**Files as the hand-off.** Team members do not see each other's conversation. They pass work through files in a work folder. See [The team](team.md).
|
|
25
|
+
|
|
26
|
+
## How a request flows
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
you: /levi break "export orders as CSV" into tasks
|
|
30
|
+
│
|
|
31
|
+
▼
|
|
32
|
+
levi (entry point) ── matches the request to a usecase description
|
|
33
|
+
│
|
|
34
|
+
▼
|
|
35
|
+
levi-brainstorming ── the usecase's SKILL.md is the workflow
|
|
36
|
+
│ calls in turn
|
|
37
|
+
├──▶ levi-pm frames the problem
|
|
38
|
+
├──▶ levi-teamlead explores approaches, breaks down the work
|
|
39
|
+
└──▶ levi-pm writes the final plan
|
|
40
|
+
│
|
|
41
|
+
▼
|
|
42
|
+
docs/brainstorming/export-orders-csv.md
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
You can skip the entry point and call the usecase directly: `/levi-brainstorming <request>`.
|
|
46
|
+
|
|
47
|
+
## Supported tool
|
|
48
|
+
|
|
49
|
+
levi supports Claude Code only: skills are read from `.claude/skills/` and subagents from `.claude/agents/`. Earlier versions also supported Codex and GitHub Copilot; see [Leftovers from earlier versions](configuration.md#leftovers-from-earlier-versions) if you installed for them.
|
package/docs/team.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# The team
|
|
2
|
+
|
|
3
|
+
Every install includes five team agents. Usecases delegate work to them. They never run on their own and never call each other: the usecase's skill calls each member in turn.
|
|
4
|
+
|
|
5
|
+
| Agent | Role |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `levi-pm` | Spec and acceptance criteria, scope, task assignments, progress and risks, plan approval, final acceptance and release notes |
|
|
8
|
+
| `levi-teamlead` | Architecture, database and migrations, conventions, task breakdown and estimates, code review, CI/CD |
|
|
9
|
+
| `levi-developer` | Implements tasks, writes unit and integration tests |
|
|
10
|
+
| `levi-designer` | User flows, wireframes, screens in SVG and HTML prototypes, design tokens, states, accessibility, handoff notes |
|
|
11
|
+
| `levi-qa` | Test plans and test cases from the spec, E2E and automated tests, bug reports, quality sign-off |
|
|
12
|
+
|
|
13
|
+
Installed agent files are named `levi-<role>` (for example `.claude/agents/levi-qa.md`). Each agent file also gets a note appended to its description: the tool should pick it only when a levi workflow delegates to it, never for other requests.
|
|
14
|
+
|
|
15
|
+
## Role skills
|
|
16
|
+
|
|
17
|
+
Some usecases are also the skill of a team role for one kind of task:
|
|
18
|
+
|
|
19
|
+
| Role | Task | Skill |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `levi-pm` | Writing or updating a spec | [`spec-writing`](usecases.md#spec-writing) |
|
|
22
|
+
| `levi-designer` | Drawing or changing designs as SVG | [`design`](usecases.md#design) |
|
|
23
|
+
| `levi-teamlead` | Reviewing code | [`code-review`](usecases.md#code-review) |
|
|
24
|
+
| `levi-qa` | Writing, changing or running test cases | [`generate-test-scenarios`](usecases.md#generate-test-scenarios) |
|
|
25
|
+
|
|
26
|
+
These usecases are installed with every install, whatever you name in `levi init`, and each agent file gets a "Your skills" section that points to the skill's guide. The agent reads that guide and follows it whenever it gets that kind of task, from any usecase, even when the prompt does not mention it. The prompt still decides what to work on, the sources and where to write.
|
|
27
|
+
|
|
28
|
+
A usecase becomes a role skill by declaring it in its `SKILL.md`; see [Authoring usecases](authoring-usecases.md#role-skills).
|
|
29
|
+
|
|
30
|
+
## Roles in detail
|
|
31
|
+
|
|
32
|
+
### levi-pm
|
|
33
|
+
|
|
34
|
+
Owns the outcome: what gets built, in what order, and whether it is ready for the end user. Does not write code, make technical decisions or call other agents.
|
|
35
|
+
|
|
36
|
+
- Turns a request into a spec (`spec.md`, or a file under `docs/specs/`): goal, users, scope, out of scope, user stories, checkable acceptance criteria. Writes only what is confirmed, and is the only role that creates, edits or deletes specs.
|
|
37
|
+
- Lists every gap that would change what gets built and returns it as a question instead of filling it in.
|
|
38
|
+
- Decides priority and records scope changes with their cost.
|
|
39
|
+
- Records who owns each task in the assignments table of `status.md`. The workflow reads the table and dispatches the agents.
|
|
40
|
+
- Approves a plan only when it covers every acceptance criterion; otherwise rejects it with the exact mismatch.
|
|
41
|
+
- Accepts the product only when each criterion has evidence in `test-report.md`, and writes release notes.
|
|
42
|
+
|
|
43
|
+
Tools: read, edit. Model tier: standard.
|
|
44
|
+
|
|
45
|
+
### levi-teamlead
|
|
46
|
+
|
|
47
|
+
The most senior developer. Makes the technical decisions. Does not implement tickets unless the workflow asks.
|
|
48
|
+
|
|
49
|
+
- Writes `architecture.md`: components, data flow, technology choices with the trade-off behind each.
|
|
50
|
+
- Designs the database schema and every migration. Any schema change goes through the teamlead.
|
|
51
|
+
- Defines structure, naming, conventions and API contracts, following what the project already does first.
|
|
52
|
+
- Writes `tasks.md`: small tasks, each with goal, files touched, done criteria, dependencies and an estimate.
|
|
53
|
+
- Reviews code for correctness, security, performance and fit, graded critical, warning or suggestion, each with a concrete fix. A critical finding blocks the merge. Every review follows the criteria of the [`code-review`](usecases.md#code-review) usecase: the OWASP Top 10, and performance and correctness. Findings go in `review.md`, or into the conversation when `code-review` runs by itself.
|
|
54
|
+
- Owns CI/CD and deployment configuration until the kit has a dedicated DevOps role.
|
|
55
|
+
|
|
56
|
+
Tools: read, edit, execute, web. Model tier: strong.
|
|
57
|
+
|
|
58
|
+
### levi-developer
|
|
59
|
+
|
|
60
|
+
Implements assigned tasks the way the teamlead designed them and proves they work.
|
|
61
|
+
|
|
62
|
+
- Builds the task from `tasks.md`, following `architecture.md`, the conventions and the design.
|
|
63
|
+
- Writes unit tests, and integration tests where a change crosses a boundary.
|
|
64
|
+
- Runs the build, linter and relevant tests before handing off, and reports real results.
|
|
65
|
+
- Does not change the architecture, schema or public API on its own, never weakens a test to make it pass, and never uses placeholder implementations.
|
|
66
|
+
|
|
67
|
+
Tools: the tool's defaults. Model tier: standard.
|
|
68
|
+
|
|
69
|
+
### levi-designer
|
|
70
|
+
|
|
71
|
+
Decides how the product looks and how people move through it.
|
|
72
|
+
|
|
73
|
+
- Maps flows and wireframes from the user stories, then produces screens as SVG files and, when useful, HTML/CSS prototypes in `docs/designs/<slug>/`.
|
|
74
|
+
- Defines design tokens once and covers every state: default, hover, focus, active, disabled, loading, empty, error, success.
|
|
75
|
+
- Shows responsive behavior and meets WCAG 2.1 AA.
|
|
76
|
+
- Writes `docs/designs/<slug>/design-notes.md` as the handoff for developers.
|
|
77
|
+
|
|
78
|
+
Tools: read, edit, web. Model tier: standard.
|
|
79
|
+
|
|
80
|
+
### levi-qa
|
|
81
|
+
|
|
82
|
+
Checks that the product does what the spec says, independently of how it was built.
|
|
83
|
+
|
|
84
|
+
- Writes `test-plan.md` from the spec and design, with test cases that each cover an acceptance criterion.
|
|
85
|
+
- Writes, changes and runs test cases with its role skill, [`generate-test-scenarios`](usecases.md#generate-test-scenarios): Markdown and Excel in `docs/tests/`, in every usecase. Only QA changes them.
|
|
86
|
+
- Runs E2E tests against the real UI and writes automated E2E and acceptance tests. Developers own unit tests.
|
|
87
|
+
- Compares the UI with `docs/designs/` and reports bugs with reproduction steps, severity and evidence in `test-report.md`.
|
|
88
|
+
- Gives the PM a clear go or no-go.
|
|
89
|
+
- Writes test cases from the spec, not from the implementation, never changes application code, and reports only results it observed.
|
|
90
|
+
|
|
91
|
+
Tools: the tool's defaults. Model tier: standard.
|
|
92
|
+
|
|
93
|
+
## The protocol
|
|
94
|
+
|
|
95
|
+
Every team agent has the shared protocol (`agents/_team-protocol.md` in the kit) appended to its instructions. Its rules:
|
|
96
|
+
|
|
97
|
+
- **Do not delegate.** Never spawn or call another agent. If the task needs another role, say so under "Handoffs".
|
|
98
|
+
- **Stay in your role.** Do only your own role's work, even when another role's task is small or the prompt asks for it. Work that belongs to another role goes under "Handoffs".
|
|
99
|
+
- **Touch only your own files.** Create, edit, move or delete only files your role owns; everything else is read-only. When asked to write a file you do not own, you do not, and say so under "Handoffs".
|
|
100
|
+
- **Specs belong to the PM alone.** Only `levi-pm` may create, edit, move or delete a spec. Every other role reports a spec problem to the PM instead of fixing it.
|
|
101
|
+
- **Hand off through files.** Other members see only what you write. Every decision, artifact and open question goes in the work folder.
|
|
102
|
+
- **Never ask the user directly.** When information is missing, finish what you can and return the questions.
|
|
103
|
+
- **Language.** Artifacts are written in the language of the request, unless the project already uses another one for its docs. Code, identifiers and commit messages stay in English.
|
|
104
|
+
- **Do not guess.** Assumptions are marked as assumptions; requirements, data and results are never invented.
|
|
105
|
+
|
|
106
|
+
### The work folder
|
|
107
|
+
|
|
108
|
+
Agents use the folder the workflow gives them. If it gives none, they use `docs/levi/<short-slug>/` at the project root. Each file has one owner; edit only your own files and read the others as input.
|
|
109
|
+
|
|
110
|
+
| File | Owner |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `spec.md`, `docs/specs/` | PM: requirements and acceptance criteria. No other role writes here |
|
|
113
|
+
| `status.md` | PM: task assignments, progress, decisions, risks, blockers |
|
|
114
|
+
| `docs/brainstorming/` | PM: execution plans |
|
|
115
|
+
| `docs/designs/` | Designer: SVG files, HTML prototypes, `design-notes.md` |
|
|
116
|
+
| `architecture.md` | Teamlead: technical design and decisions |
|
|
117
|
+
| `tasks.md` | Teamlead: task breakdown and estimates |
|
|
118
|
+
| `review.md` | Teamlead: code review findings |
|
|
119
|
+
| Database schema, migrations, CI/CD and deployment config | Teamlead |
|
|
120
|
+
| Application code, unit and integration tests, technical docs of the code | Developer |
|
|
121
|
+
| `choices/<role>-<topic>.md` | Whoever made the choice: one small file per choice picked instead of asked (see [Unattended runs](unattended-runs.md)) |
|
|
122
|
+
| `test-plan.md` | QA: test plan and test cases |
|
|
123
|
+
| `docs/tests/` | QA: numbered test scenarios and test cases, with their PASS or FAIL results once run |
|
|
124
|
+
| `test-report.md` | QA: results, bugs, sign-off |
|
|
125
|
+
| E2E and acceptance tests | QA |
|
|
126
|
+
|
|
127
|
+
### Reply format
|
|
128
|
+
|
|
129
|
+
Every reply ends with this report:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
**Status:** DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
|
|
133
|
+
**Summary:** one or two sentences
|
|
134
|
+
**Files:** files you created or changed
|
|
135
|
+
**Handoffs:** work for other roles, or "none"
|
|
136
|
+
**Questions:** open questions for the user, or "none"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The workflow reads this report to decide what to do next and what to ask you.
|
|
140
|
+
|
|
141
|
+
## Changing the team
|
|
142
|
+
|
|
143
|
+
The agent files are installed into your project, so you can edit them: add your test conventions to `levi-qa`, your stack to `levi-developer`. `levi update` keeps those edits. See [Customization](customization.md).
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
## `/levi` is not recognized
|
|
4
|
+
|
|
5
|
+
- Check that the files exist: `.claude/skills/levi/SKILL.md`. If not, run `npx levi-gear@latest init`.
|
|
6
|
+
- Make sure you ran `init` in the project root, not a subfolder.
|
|
7
|
+
- Restart Claude Code or open a new session: skills are loaded at start.
|
|
8
|
+
|
|
9
|
+
## The entry point picks the wrong usecase
|
|
10
|
+
|
|
11
|
+
It matches your request to usecase descriptions and runs the best match, naming a close runner-up. Call the one you want directly: `/levi-<usecase> <request>`. If the match is wrong because the request is vague, say what you want the output to be.
|
|
12
|
+
|
|
13
|
+
## The entry point says no usecase fits
|
|
14
|
+
|
|
15
|
+
Nothing installed matches the request. Run `npx levi-gear@latest list` to see what the kit offers, and `init <usecase>` to add one.
|
|
16
|
+
|
|
17
|
+
## `update` keeps a file I did not edit
|
|
18
|
+
|
|
19
|
+
A file counts as changed when its content differs from the hash in `.levi.json`. Common causes:
|
|
20
|
+
|
|
21
|
+
- **An editor or formatter changed it**, for example trailing whitespace or a reformat on save. Compare it with the kit version using `update --force` on a copy, or accept the file as customized.
|
|
22
|
+
- **An old config without hashes.** Early versions recorded paths only. Every file that differs from the kit counts as changed. Run `npx levi-gear@latest update --force` once to record hashes. Back up files you did edit first.
|
|
23
|
+
- **Line endings.** CRLF versus LF does not count as an edit, so this is not the cause.
|
|
24
|
+
|
|
25
|
+
`levi status` names each kept file.
|
|
26
|
+
|
|
27
|
+
## A file reports as "not managed by levi"
|
|
28
|
+
|
|
29
|
+
The path existed before levi wrote it, so levi will not overwrite it. Rename or move your file and run `update`, or take the kit version with `update --force <path>` if yours is disposable.
|
|
30
|
+
|
|
31
|
+
## A file I deleted is not coming back
|
|
32
|
+
|
|
33
|
+
By design. `update` does not recreate files you deleted. Use `update --force <path>` to restore one.
|
|
34
|
+
|
|
35
|
+
## `update` did not add a new usecase
|
|
36
|
+
|
|
37
|
+
`update` only refreshes usecases you already installed. Add the new one with `npx levi-gear@latest init <usecase>`.
|
|
38
|
+
|
|
39
|
+
## `No .levi.json found. Run "levi init" first.`
|
|
40
|
+
|
|
41
|
+
You ran `update` or `status` in a folder that has no install, or that you installed without committing `.levi.json`. Run the command from the project root, or run `init`.
|
|
42
|
+
|
|
43
|
+
## `.levi.json` conflicts when merging branches
|
|
44
|
+
|
|
45
|
+
Two branches changed the install (different versions or usecases). Resolve the conflict, then run `npx levi-gear@latest status` to see whether the files and the recorded hashes still agree. If they do not, run `update`: files you changed are kept, the rest are brought in line. A hash that no longer matches an untouched file simply makes `update` replace it with the kit version.
|
|
46
|
+
|
|
47
|
+
## A subagent is not used
|
|
48
|
+
|
|
49
|
+
Team agents are used only when a usecase delegates to them, by design. Their descriptions tell the tool to select them for nothing else. To work with an agent yourself, run a usecase that uses it, or call it by name in your tool.
|
|
50
|
+
|
|
51
|
+
## Agents asked me nothing, or asked too much
|
|
52
|
+
|
|
53
|
+
Team agents never ask you directly; they return questions and the usecase's workflow relays them, usually once. If a workflow should ask differently, edit its `SKILL.md`. See [Customization](customization.md).
|
|
54
|
+
|
|
55
|
+
## Files left behind in `docs/levi/`
|
|
56
|
+
|
|
57
|
+
A usecase writes scratch files there during a run and deletes them at the end. An interrupted run leaves them behind, together with `docs/breakpoints/handoff.md` when the quota guard fired. Delete the folder only when you intentionally abandon the run.
|
|
58
|
+
|
|
59
|
+
## Where to look for what changed
|
|
60
|
+
|
|
61
|
+
- `git diff` shows what `update` changed.
|
|
62
|
+
- `.levi.json` lists every file levi manages.
|
|
63
|
+
- [Configuration and file layout](configuration.md) explains where the files go.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Unattended runs
|
|
2
|
+
|
|
3
|
+
You are often not at the keyboard while a usecase runs. Every usecase follows three rules so that it does not stop half-way for you. They are written once, in `usecases/_run-rules.md`, and the installer appends them to every installed `SKILL.md`.
|
|
4
|
+
|
|
5
|
+
## 1. Everything is asked up front
|
|
6
|
+
|
|
7
|
+
A run starts with a cheap discovery pass: it reads the request, the matching specs, plans and designs and the project, and calls the agents that only frame or analyze. From that it builds the whole list of what is missing, unclear or contradictory, which existing spec, plan or design to reuse, and every step that cannot be undone or that others can see (deleting, publishing, pushing, deploying, spending money). It asks all of it in **one round**, then tells you that the run now continues on its own.
|
|
8
|
+
|
|
9
|
+
After that round it does not ask again. A question that comes up later is parked: everything that does not depend on it goes on, and the parked questions come back together at the end, with the assumption used meanwhile.
|
|
10
|
+
|
|
11
|
+
It asks only about facts only you know, scope and acceptance criteria, irreversible or visible actions, and picks where a wrong guess would waste a large part of the work. Everything else is a choice.
|
|
12
|
+
|
|
13
|
+
## 2. Choices are picked, not asked
|
|
14
|
+
|
|
15
|
+
When the work yields several acceptable options and a pick is cheap to undo (four logo variants, a layout, a palette, a name, a wording), the run takes the recommended option, or the best by its own judgment, and goes on. It records each pick in `docs/levi/<slug>/choices/<who>-<topic>.md` (what was chosen between, the pick, why, the alternatives, how to switch) and keeps the rejected options reachable, for files in an `alternatives/` folder next to the deliverable.
|
|
16
|
+
|
|
17
|
+
The final report ends with **Choices I made for you**: every choice, the pick, the alternatives and how to change it. You change what you disagree with; nothing else is needed. The list is given even when the run ends early.
|
|
18
|
+
|
|
19
|
+
## 3. The quota guard
|
|
20
|
+
|
|
21
|
+
A run with more than one stage checks how much of the 5-hour usage window is used at every stage boundary (`scripts/quota-check.mjs check`, in every skill folder). At **95% or more** it finishes the step in progress, makes sure the work folder holds what is done, writes the handoff report `docs/breakpoints/handoff.md` (see below), arms a job that resumes the run every 2 hours, and keeps working. If the limit then stops the run, the job fires once the quota is back and sends:
|
|
22
|
+
|
|
23
|
+
> I ran out of quota a moment ago and the run was interrupted. Please continue the process or workflow you were running.
|
|
24
|
+
|
|
25
|
+
The resumed run continues from its recorded stage without repeating finished ones. It removes the job once usage is below 95%, and the run removes it in any case when it ends.
|
|
26
|
+
|
|
27
|
+
The job is `CronCreate`, recurring `7 */2 * * *`, inside the Claude Code session, so the session has to stay open (it does while waiting for the limit). The usage is read from a file the statusline writes (setup below).
|
|
28
|
+
|
|
29
|
+
**When the usage cannot be read** (no statusline setup below, or API-key billing), the run arms the same job right after the opening questions, so you are covered anyway, and removes it when the run ends.
|
|
30
|
+
|
|
31
|
+
### The handoff report
|
|
32
|
+
|
|
33
|
+
At the 95% threshold the run also writes one file, `docs/breakpoints/handoff.md`. It is always that single file, and each new interruption overwrites it whole (still-unfinished items are carried over). It starts with a status line (`interrupted` or `complete`) and holds the goal and your answers, the project context, a stage table (done, in progress, not started), the deliverables and decisions so far, the ordered next steps, the state of the files, open items, and how to continue. It is written for a reader with no other context, so the session that resumes after the reset, or a different agent that you hand the file to, needs nothing else to carry on. The resumed run reads it first; when the run ends it overwrites the file with `Status: complete`. It never contains secrets.
|
|
34
|
+
|
|
35
|
+
### Setting up the statusline (Claude Code, once)
|
|
36
|
+
|
|
37
|
+
Claude Code shows the usage only to the statusline command. Point it at the helper, which saves the number to `~/.claude/levi-quota.json` (or `$CLAUDE_CONFIG_DIR`) and prints `5h 42%`. In your Claude Code settings:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{ "statusLine": { "type": "command", "command": "node /abs/path/to/.claude/skills/levi-brainstorming/scripts/quota-check.mjs record" } }
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To keep a statusline you already have, pipe into it: `node .../quota-check.mjs record --passthrough | <your command>`. Any levi skill folder has the same helper. It works for Pro and Max plans only; the number appears after the session's first response.
|
|
44
|
+
|
|
45
|
+
### Good to know
|
|
46
|
+
|
|
47
|
+
- Claude Code can also wait out the limit by itself ("Continue automatically at usage limit" in `/config`). The job is the backup for when that stops, for example after two limit hits in a row.
|
|
48
|
+
- A scheduled prompt that fires while the limit is still on may fail; it is tried again 2 hours later.
|
|
49
|
+
- `node scripts/quota-check.mjs check` prints the current usage as JSON, which is handy to test the setup.
|
package/docs/updating.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Updating
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npx levi-gear@latest update
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
`update` refreshes the installed files to the version of the package you run. It never overwrites or deletes a file you changed.
|
|
8
|
+
|
|
9
|
+
## How your edits are protected
|
|
10
|
+
|
|
11
|
+
Installed files are yours: you can edit them to fit your project. When levi writes a file at install time, it records a SHA-256 hash of the content in `.levi.json`. On `update`, it compares each file on disk with that recorded hash:
|
|
12
|
+
|
|
13
|
+
- Same hash: you have not touched it, so it is safe to replace.
|
|
14
|
+
- Different hash: you changed it, so it is left alone.
|
|
15
|
+
|
|
16
|
+
Line endings do not count as an edit. Text is hashed with CRLF folded to LF, so Git's `core.autocrlf` rewriting a file does not make it look customized.
|
|
17
|
+
|
|
18
|
+
## What `update` does to each file
|
|
19
|
+
|
|
20
|
+
| State of the file | What `update` does |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Untouched | Replaces it with the new version, or deletes it if the kit dropped it |
|
|
23
|
+
| You changed it | Keeps your file and ignores the kit's version |
|
|
24
|
+
| You deleted it | Does not recreate it |
|
|
25
|
+
| New in the kit | Adds it |
|
|
26
|
+
| Path already exists and was not written by levi | Keeps your file and ignores the kit's version |
|
|
27
|
+
|
|
28
|
+
levi does not merge. A file you changed is yours from then on and stops receiving kit updates until you run `--force` on it.
|
|
29
|
+
|
|
30
|
+
## Preview first: `levi status`
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx levi-gear@latest status
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Runs the same comparison as `update` but writes nothing. It prints what `update` would add, update and remove, and lists the files it would keep. Use it before updating to see which of your files will not get the new version.
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
Would add 2, update 6, remove 0 file(s).
|
|
40
|
+
|
|
41
|
+
Changed by you (kept as is):
|
|
42
|
+
.claude/agents/levi-qa.md
|
|
43
|
+
|
|
44
|
+
To take the kit version of a file instead: levi update --force [path...]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Note that `status` compares against the package version you run it with: `npx levi-gear@latest status` shows what updating to the latest version would do.
|
|
48
|
+
|
|
49
|
+
## After an update
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
Updated 0.1.0 -> 0.2.0 (1 usecase(s))
|
|
53
|
+
Added 2, updated 6, removed 0 file(s).
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`update` also regenerates the `levi` entry point from the installed usecases, rewrites `.levi.json` with the new version and hashes, and prints the invocation syntax. Commit the changed files and `.levi.json`.
|
|
57
|
+
|
|
58
|
+
### The report
|
|
59
|
+
|
|
60
|
+
| Section | Meaning |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `Changed by you (kept as is)` | You edited the file; the kit's new version was ignored |
|
|
63
|
+
| `Already exist and are not managed by levi (kept as is)` | The path exists but levi did not write it, so it will not overwrite it |
|
|
64
|
+
| `Deleted by you (not recreated)` | You removed a file levi installed; it stays removed |
|
|
65
|
+
| `No longer in the kit, kept because you changed them` | The kit dropped the file, but you had edited it, so it was not deleted. It is also no longer tracked |
|
|
66
|
+
|
|
67
|
+
## Taking the kit version of a file
|
|
68
|
+
|
|
69
|
+
To discard your changes to a file and take the kit version, use `--force`.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# one or more files, by project-relative path as shown in the report
|
|
73
|
+
npx levi-gear@latest update --force .claude/agents/levi-qa.md
|
|
74
|
+
|
|
75
|
+
# every file you changed
|
|
76
|
+
npx levi-gear@latest update --force
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`--force` also applies to the other kept cases: a path that existed before levi, and a file you deleted (it is recreated).
|
|
80
|
+
|
|
81
|
+
Before forcing a file you customized, copy your version somewhere so you can reapply your edits to the new one.
|
|
82
|
+
|
|
83
|
+
## New usecases in the kit
|
|
84
|
+
|
|
85
|
+
`update` refreshes only the usecases you already installed. It does not add usecases that are new in the kit. To get one, name it:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx levi-gear@latest list # see what the kit offers
|
|
89
|
+
npx levi-gear@latest init <usecase> # add it; your other usecases stay
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Team agents and the entry point are always updated.
|
|
93
|
+
|
|
94
|
+
## Usecases removed from the kit
|
|
95
|
+
|
|
96
|
+
If an installed usecase no longer exists in the new version, `update` removes its files that you did not change, keeps the ones you edited, and prints `<id> is no longer in the kit; its unchanged files were removed.`
|
|
97
|
+
|
|
98
|
+
## Upgrading from a version that supported Codex or Copilot
|
|
99
|
+
|
|
100
|
+
`update` removes the Codex and Copilot files an older install wrote (`.agents/skills/`, `.codex/agents/`, `.github/agents/`) when you did not edit them, keeps and reports the ones you did, and drops the `tools` field from `.levi.json`. See [Leftovers from earlier versions](configuration.md#leftovers-from-earlier-versions).
|
|
101
|
+
|
|
102
|
+
## Typical flow
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx levi-gear@latest status # what would change?
|
|
106
|
+
npx levi-gear@latest update # apply, keeping your edits
|
|
107
|
+
git diff # review
|
|
108
|
+
git add -A && git commit -m "chore: update levi"
|
|
109
|
+
```
|
package/docs/usage.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Usage
|
|
2
|
+
|
|
3
|
+
levi runs only when you ask for it. Everything you type that does not start with the levi command is handled by Claude Code as usual.
|
|
4
|
+
|
|
5
|
+
## Invoking
|
|
6
|
+
|
|
7
|
+
| Let levi pick the usecase | Call a usecase directly |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `/levi <request>` | `/levi-<usecase> <request>` |
|
|
10
|
+
|
|
11
|
+
In Codex use `$levi <request>` and `$levi-<usecase> <request>` instead. See
|
|
12
|
+
[Codex support](codex.md) for checkpoint recovery.
|
|
13
|
+
|
|
14
|
+
## The entry point: `levi <request>`
|
|
15
|
+
|
|
16
|
+
The entry point is a skill generated at install time from the usecases you installed. It follows these steps:
|
|
17
|
+
|
|
18
|
+
1. **Empty request:** lists the installed usecases, one line each, and asks what you want.
|
|
19
|
+
2. **No usecase fits:** says so, lists the usecases, and stops. It does not improvise a substitute.
|
|
20
|
+
3. **One or more fit:** runs the best match. When several fit about equally, it takes the one whose description names your main goal most specifically. It does not ask you to choose.
|
|
21
|
+
4. It tells you which usecase it chose in one line. When another was a close match, it names it and says that `/levi-<usecase>` runs it directly.
|
|
22
|
+
|
|
23
|
+
The request can be written in any language. The match is by meaning against each usecase's description, and the answer comes back in the language you used.
|
|
24
|
+
|
|
25
|
+
Because the entry point is generated from what is installed, installing or removing a usecase changes what it can pick. After `levi init <usecase>` or `levi update`, the entry point is regenerated.
|
|
26
|
+
|
|
27
|
+
## Calling a usecase directly
|
|
28
|
+
|
|
29
|
+
When you know which usecase you want, skip the matching:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
/levi-brainstorming how should we migrate the billing tables to the new schema
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This is also the way to run the runner-up when the entry point picked a different usecase.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
# let levi choose
|
|
41
|
+
/levi we need to let users export orders as CSV, what is the plan?
|
|
42
|
+
|
|
43
|
+
# direct call
|
|
44
|
+
/levi-brainstorming split the checkout refactor into tasks and estimate it
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## What happens during a run
|
|
48
|
+
|
|
49
|
+
A usecase is a workflow. While it runs:
|
|
50
|
+
|
|
51
|
+
- The usecase's skill calls team agents one at a time (`levi-pm`, `levi-teamlead`, ...). Team agents never run on their own and never call each other.
|
|
52
|
+
- Agents cannot ask you questions directly. They return their open questions, and the workflow relays them to you, usually once, as a batch. Questions come with options and a recommended answer. An unanswered question takes the recommended option and is recorded as an assumption.
|
|
53
|
+
- Agents hand work to each other through files in a work folder, by default `docs/levi/<slug>/`. Some usecases delete these scratch files at the end and leave only the deliverable.
|
|
54
|
+
- Every agent ends its reply with a status report (`DONE`, `DONE_WITH_CONCERNS`, `BLOCKED` or `NEEDS_CONTEXT`). See [The team](team.md#reply-format).
|
|
55
|
+
|
|
56
|
+
## Listing what is available
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx levi-gear@latest list
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Prints each usecase of the kit with its description and the agents it owns, then the invocation syntax. See [CLI reference](cli.md#levi-list).
|