@zalom/plastic 2.0.1 → 2.0.3

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 (50) hide show
  1. package/PLASTIC.md +2 -1
  2. package/README.md +40 -33
  3. package/agents/plastic-enforcer.md +13 -11
  4. package/agents/plastic-executor.md +2 -1
  5. package/agents/plastic-primary-advisor.md +2 -2
  6. package/agents/plastic-secondary-advisor.md +2 -2
  7. package/bin/plastic +2 -0
  8. package/docs/help/agent-architecture.md +9 -8
  9. package/docs/help/agent-report-contract.md +6 -4
  10. package/docs/help/completion-and-done.md +20 -4
  11. package/docs/help/human-report-contract.md +23 -20
  12. package/docs/help/knowledge-graph.md +2 -2
  13. package/docs/help/lifecycle-and-savepoints.md +9 -5
  14. package/docs/help/locks-and-worktrees.md +4 -3
  15. package/docs/help/maintenance-and-revisions.md +2 -2
  16. package/docs/help/roadmaps.md +16 -11
  17. package/docs/help/track-1-guided.md +48 -30
  18. package/docs/help/track-2-auto.md +35 -10
  19. package/docs/help/track-3-projects-and-roadmaps.md +10 -7
  20. package/docs/help/tutorial.md +421 -0
  21. package/package.json +1 -1
  22. package/scripts/end-intent +312 -69
  23. package/scripts/lib/arm.rb +28 -10
  24. package/scripts/lib/cli/commands/auto_lock.rb +17 -5
  25. package/scripts/lib/cli/commands/auto_take.rb +38 -1
  26. package/scripts/lib/cli/commands/doctor.rb +2 -2
  27. package/scripts/lib/cli/commands/intent_command.rb +6 -1
  28. package/scripts/lib/cli/commands/intent_end.rb +15 -2
  29. package/scripts/lib/cli/commands/intent_step.rb +8 -0
  30. package/scripts/lib/cli/commands/project_links.rb +5 -1
  31. package/scripts/lib/cli/commands/project_new.rb +24 -1
  32. package/scripts/lib/cli/commands/render.rb +3 -1
  33. package/scripts/lib/cli/commands/roadmap_next.rb +10 -3
  34. package/scripts/lib/cli/commands/roadmap_show.rb +21 -1
  35. package/scripts/lib/cli/commands/session_commit.rb +1 -1
  36. package/scripts/lib/cli/commands/sync.rb +10 -1
  37. package/scripts/lib/hook_replay.rb +51 -45
  38. package/scripts/lib/installer_core.rb +12 -0
  39. package/scripts/lib/node_input.rb +13 -5
  40. package/scripts/lib/revisions_writer.rb +1 -2
  41. package/scripts/lib/roadmap_queue.rb +12 -4
  42. package/scripts/lib/runner_dispatch.rb +8 -7
  43. package/scripts/lib/session_git.rb +42 -1
  44. package/scripts/lib/untouched_scaffold.rb +51 -0
  45. package/scripts/plastic-lock +24 -28
  46. package/scripts/project-links +6 -21
  47. package/scripts/roadmap-graph +10 -4
  48. package/scripts/rollback.rb +5 -1
  49. package/scripts/update.rb +7 -1
  50. package/skills/_decision-tables.md +3 -3
@@ -7,19 +7,24 @@ This chapter holds the full roadmap file format and its relationship to INDEX.md
7
7
  Roadmaps exist for planned parallel delivery of intents in a coherent and organized way. A roadmap
8
8
  is a named, ordered, delivery-side collection of intents: the delivery-side counterpart to a
9
9
  release (completion-side, tracked in `CHANGELOG.md`). Create one by hand from the template, then
10
- use `plastic roadmap show`, `next`, `log`, and `check` to read, drive, and audit it.
10
+ use `plastic roadmap show`, `next`, `log`, `check`, and `migrate` to read, drive, audit, and
11
+ upgrade it.
11
12
 
12
13
  File location: `roadmaps/{slug}.md`, a sibling of `INDEX.md`, wherever `INDEX.md` lives, never
13
14
  inside `store/` (store holds intent directories, not project artifacts). For a project that is its
14
- root, `~/.plastic/projects/{slug}/roadmaps/`, beside `project.yml`; for the global tier it is
15
- `~/.plastic/roadmaps/`, beside `~/.plastic/INDEX.md`. `roadmaps/` lists only live (open or
16
- in-flight) roadmaps: once a roadmap's goal is reached, it moves to `roadmaps/archived/{slug}.md`,
17
- a sibling subdirectory scaffolded once with a `.gitkeep`.
18
-
19
- A roadmap file has four sections, in order: a title/meta header, `## Goal`, `## Batches`, and an
20
- append-only dated `## Log`. `## Goal` is a checkable prose condition read by a human or agent, not
21
- an executable checker. `## Batches` holds ordered batches; entries inside a batch are
22
- parallel-safe, batches run sequentially, top to bottom. A roadmap written before owner ruling 145
15
+ root, `~/.plastic/stores/{slug}/roadmaps/`, beside `project.yml`; for the global store it is
16
+ `~/.plastic/stores/global/roadmaps/`, beside its `INDEX.md`. Legacy homes keep their
17
+ previous paths until `plastic migrate stores` moves them. `roadmaps/` lists only live (open or
18
+ in-flight) roadmaps: once a roadmap's goal is reached, move it by hand to
19
+ `roadmaps/archived/{slug}.md`. Its ledger and its screens still resolve it there.
20
+
21
+ A roadmap file from the template has five sections, in order: a title/meta header, `## Goal`,
22
+ `## Graph`, `## Batches`, and an append-only dated `## Log`.
23
+ `## Goal` is a checkable prose condition read by a human or agent, not an executable checker.
24
+ `## Graph` holds the `needs` edges between entries, and the batches are computed from them;
25
+ `plastic roadmap migrate` writes a Graph section for a roadmap that has none, from its current
26
+ batch order. `## Batches` holds ordered batches; entries inside a batch are parallel-safe,
27
+ batches run sequentially, top to bottom. A roadmap written before owner ruling 145
23
28
  may instead use the legacy `## Waves` heading; the tooling accepts both, but never renames an
24
29
  existing roadmap file to migrate it.
25
30
 
@@ -38,7 +43,7 @@ next in under a minute.
38
43
 
39
44
  **Relationship to loop engineering (intent 69).** A roadmap is the planning half of the work; the
40
45
  loop is its runtime. Batches lay out the parallelism plan: what can run together, and in what order.
41
- Loop engineering (intent 69, not yet delivered) is expected to consume that plan and supply the
46
+ Loop engineering (intent 69) is expected to consume that plan and supply the
42
47
  running parts, the heartbeat, how many dispatches run at once, checking the goal, and resuming
43
48
  after a stop. This section only states the relationship and points to intent 69 as the future
44
49
  consumer; it does not change intent 69's own design.
@@ -12,11 +12,15 @@ end to end: a piece of work moved through What, Why, How, and Exec, with a finis
12
12
  Run `plastic update` first, so the commands below match what is
13
13
  actually installed.
14
14
 
15
- Work in a sandbox: this track always creates a global-store intent; the throwaway repo below
16
- is never registered as a Plastic project. Pick a throwaway git repository if you have one
17
- handy, since the worked example edits its README: station 6's deliverable is that file edit.
18
- No repo handy? Station 6's deliverable becomes a short written note saved in the intent's own
19
- directory instead (see station 6). Either way, nothing in this track touches a real project.
15
+ This track walks a graph intent: the plan is a `graph.md` of nodes that the runner dispatches.
16
+ For the simpler checklist path, a small Ruby example taken from a new intent to merged code and
17
+ a delivered close, run `plastic help tutorial` instead.
18
+
19
+ Work in a sandbox. Run `plastic intent new` outside any registered project and the intent lands
20
+ in the global store; run it inside a registered throwaway repository and it lands in that
21
+ project's store, and the close can check the merge. The worked example edits the repository's
22
+ README. With no repository, the deliverable is a short written note saved in the intent's own
23
+ directory (see station 5). Either way, nothing in this track touches a real project.
20
24
 
21
25
  ## Stations
22
26
 
@@ -33,16 +37,15 @@ Checkpoint: open the new file. It already has a real id and a one-line descripti
33
37
  was hand-typed into it directly. That is the point: intents are always scaffolded by the
34
38
  tool, never written by hand.
35
39
 
36
- ### 2. Board the intent
40
+ ### 2. Read where it stands
37
41
 
38
- Run `plastic continue` and name the intent.
42
+ Run `plastic intent show ID`.
39
43
 
40
- Artifact: a delivery lock (a `delivery.lock` file in the intent directory) naming this
41
- session as the one owner, and a line in `savepoint.md` recording the stage. The agent then
42
- resumes at the last delivered station and asks nothing.
44
+ Artifact: none. The command only reads. It prints the intent's state screen, and its `next:`
45
+ line names the step to run: `plastic intent spec ID` while the intent has no spec or graph.
46
+ `plastic continue` reads the same way for the whole project. Neither takes a lock.
43
47
 
44
- Checkpoint: explain in one sentence why the lock matters: it stops two
45
- sessions from editing the same intent at the same time.
48
+ Checkpoint: name the step the `next:` line points at, and why.
46
49
 
47
50
  ### 3. Why, rulings one at a time
48
51
 
@@ -50,17 +53,20 @@ Run `plastic intent spec` (say "grill me" for a harder, interview-style pass ove
50
53
  the same ground). It asks conversational prose questions, one at a
51
54
  time, never a multiple-choice menu, and answers them one at a time in return.
52
55
 
53
- Artifact: `## Context` and `### Decisions` in the intent file fill in as each answer lands, and
54
- each ruling also lands as its own `## Insights` entry the moment it is made, never batched for
55
- later. This station's product is the enriched Why; it hands off to `plastic intent spec`
56
- next, it does not write `spec.md` itself.
56
+ Artifact: each ruling lands as its own `## Insights` entry the moment it is made, never batched
57
+ for later, through `plastic intent rule ID "TEXT"`, stamped with the time, the `Why` stage and
58
+ the `human` author. `intent rule` writes nothing else: the agent edits `## Context` and any
59
+ `### Decisions` list by hand. This station's product is the enriched Why; neither command
60
+ writes `spec.md`.
57
61
 
58
62
  Checkpoint: after two or three answers, look at the intent file. Every ruling given out loud
59
- is already sitting in `### Decisions` and in `## Insights`, in writing.
63
+ is already sitting in `## Insights`, in writing.
60
64
 
61
65
  ### 4. How, write the graph
62
66
 
63
- Ask the same conversation (`plastic intent spec`) to turn the rulings into the graph.
67
+ In the same conversation, the agent turns the rulings into the graph. It writes `graph.md` from
68
+ `templates/graph.md`. No command creates it; once it exists, the runner behind
69
+ `plastic intent step` and `plastic intent answer` updates it.
64
70
 
65
71
  Artifact: `graph.md` (nodes, edges, dispatch policy) and one `nodes/N.md` file per node this
66
72
  small delivery needs. A delivery this size is one node; many independent tasks instead get
@@ -70,35 +76,47 @@ Checkpoint: open `graph.md` and point at the one node this worked example needs.
70
76
 
71
77
  ### 5. Exec, drive the runner loop
72
78
 
73
- Run `plastic intent step`.
79
+ Run `plastic intent step ID`.
80
+
81
+ Graph execution needs the delivery lock. Without it, `intent step` names
82
+ `plastic auto take ID` as the next step. From a conversation session, `auto take` refuses with
83
+ exit 3 unless the owner approves `--allow-inline`; stop and report the refusal.
74
84
 
75
- Teach the loop: `ruby scripts/runner step <intent_dir>` computes which nodes are ready and
76
- prints a spawn block to dispatch, `ruby scripts/runner status <intent_dir>` reads the
77
- ledger (running, done, blocked, or waiting on a decision), and `ruby scripts/runner answer`
78
- closes a node that needs an owner's ruling. Call `step` again after each dispatched node
79
- returns, until the graph is empty.
85
+ Teach the loop: `plastic intent step ID` runs the internal `runner step`, which computes which
86
+ nodes are ready and prints a spawn block to dispatch. Pass a returned node back with
87
+ `plastic intent step ID --return NODE=PATH`. `plastic intent answer ID --node NODE --decision
88
+ "TEXT"` closes a node that waits on an owner's ruling. The internal
89
+ `ruby ~/.plastic/scripts/runner status <intent_dir>` reads the ledger (running, done, blocked,
90
+ or waiting on a decision); no public command wraps it. Call `step` again after each
91
+ dispatched node returns, until the graph is empty.
80
92
 
81
93
  Artifact: the actual change on disk (the new README Usage section, or, in the global-store
82
94
  fallback, a short written note saved as the intent's deliverable) and every node in
83
95
  `graph.md` at a terminal status.
84
96
 
85
97
  Checkpoint: run `runner status` and confirm no node is left running or blocked, before
86
- moving to station 6.
98
+ moving to station 6. When the graph is complete, `intent step` names `plastic intent verify ID`.
87
99
 
88
100
  ### 6. End
89
101
 
90
- Run `plastic intent end`.
102
+ Run `plastic intent end ID --delivered --summary "TEXT"`. Add `--dry-run` first to see what
103
+ the close would do without writing anything.
104
+
105
+ When the intent has a code branch or worktree, merge the branch yourself first. Plastic does
106
+ not merge, and a delivered close refuses unmerged code with exit 1.
91
107
 
92
- Artifact: a real `outcome.md` (Summary, Delivered, Verification, Follow-ups) generated by
93
- `scripts/outcome-report` from `graph.md` and the ledger, the intent moved from `## Active`
94
- to `## Completed` in `INDEX.md`, and the terminal savepoint line.
108
+ Artifact: a real `outcome.md` (Summary, Delivered, Verification, Follow-ups) generated from
109
+ `graph.md` and the ledger (the same model as the internal `scripts/outcome-report`), the
110
+ intent moved from `## Active` to `## Completed` in `INDEX.md`, the terminal savepoint line,
111
+ and the lock and worktree released.
95
112
 
96
113
  Checkpoint: open `outcome.md` and read its Summary. It should describe, in a sentence or
97
114
  two, exactly the README section (or note) just delivered.
98
115
 
99
116
  ## Wrap and where to go next
100
117
 
101
- That is the full cycle once: create, graph, runner step, end. Read
118
+ That is the full cycle once: create, graph, runner step, end. Run `plastic help tutorial` for
119
+ the checklist path with a merged code change. Read
102
120
  [`your-first-intent-in-10-minutes.md`](https://github.com/zalom/plastic/blob/main/docs/guides/your-first-intent-in-10-minutes.md) for the same path condensed to a single
103
121
  read, and [`reading-the-ledgers.md`](https://github.com/zalom/plastic/blob/main/docs/guides/reading-the-ledgers.md) for where each station wrote its
104
122
  work down.
@@ -3,7 +3,7 @@
3
3
  ## Who it is for and what you will have done
4
4
 
5
5
  For someone who has seen the stages once (track 1) and now wants to hand the work to the
6
- agent, watch it move through the gates and reports on its own, and learn how to check in on
6
+ agent, watch it move through the stages and reports on its own, and learn how to check in on
7
7
  it and step back in later. After this track, one small intent will have been delivered by the
8
8
  agent end to end, and pausing and resuming that delivery will feel familiar.
9
9
 
@@ -22,12 +22,26 @@ track touches a real project.
22
22
  Start from an active intent (create one first with `plastic intent new` if none
23
23
  exists, the same way as track 1 station 1). Run `plastic auto take ID`.
24
24
 
25
- Artifact: the delivery lock arms, and the agent announces it is taking over the intent for
26
- autonomous delivery.
25
+ Artifact: the delivery lock arms (`delivery.lock` in the intent directory) and the code
26
+ worktree is made at `<repo>/.claude/worktrees/ID--slug` on branch `plastic/ID--slug`. The
27
+ command prints both:
27
28
 
28
- Checkpoint: name the one precondition auto needs before it will start: an active intent must
29
- already exist for the intent you name. (Say "auto" with nothing named, and it can pick a
30
- queued intent from the dashboard's queue itself.)
29
+ ```text
30
+ intent 2--shout
31
+ lock acquired by auto-9184f6c4fa, auto mode
32
+ worktree /home/you/greeter/.claude/worktrees/2--shout
33
+ ```
34
+
35
+ Run from inside a conversation session, `plastic auto take` refuses with exit 3: an intent is
36
+ not delivered inline. The owner may approve an inline take with `--allow-inline`. Otherwise
37
+ the harness spawns the team, and the team takes the intent. Exit 3 means stop and report; never
38
+ retry with another flag on your own.
39
+
40
+ `plastic auto brief ID` prints the preamble the spawned lead starts from, and
41
+ `plastic auto lock status ID` shows who holds the lock.
42
+
43
+ Checkpoint: name the one precondition auto needs before it will start: the intent you name
44
+ must already exist in the store the command resolves to.
31
45
 
32
46
  ### 2. What auto does, and what stays with the user
33
47
 
@@ -39,7 +53,7 @@ working copy with the main line before touching anything, ticks each task the mo
39
53
  lands rather than batching several into one later edit, and independently verifies its own
40
54
  work (running the test suite, or checking the changed file) before presenting anything back
41
55
  to you. For a task shaped like an audit or a sweep, checking many files rather than building
42
- one artifact, it also drops a short methods report into `resources/` before the gate, so you
56
+ one artifact, it also drops a short methods report into `resources/` before the close, so you
43
57
  can review how it checked, not just what it found.
44
58
 
45
59
  The user keeps two things: the rulings made along the way, and the review points, moments
@@ -76,13 +90,24 @@ line.
76
90
 
77
91
  Run `plastic continue`.
78
92
 
79
- Artifact: the current state, presented and then the session stops. If a specific intent is
80
- named, the agent reads its stage and savepoint and resumes exactly there, rather than
81
- starting over.
93
+ Artifact: where the project stands and a `next:` line naming what runs next. `plastic
94
+ continue` only reads: it takes no lock and changes no file. To resume one intent, run
95
+ `plastic intent show ID`; its Next row names the step it resumes at, read from the files on
96
+ disk.
82
97
 
83
98
  Checkpoint: after stepping away and running this command, name the stage the intent resumed
84
99
  at and how that matched what was actually on disk.
85
100
 
101
+ ### 6. The close
102
+
103
+ The lead closes the intent with `plastic intent end ID --delivered --summary "TEXT"`. The
104
+ close checks that the code branch is merged and refuses with exit 1 when it is not; Plastic
105
+ does not merge. It also refuses to deliver an untouched scaffold. On success it writes
106
+ `outcome.md` from the record, moves the intent to `## Completed`, and releases the lock and
107
+ the worktree.
108
+
109
+ Checkpoint: open `outcome.md` and read its Summary.
110
+
86
111
  ## Wrap and where to go next
87
112
 
88
113
  Auto keeps the same stages and the same record as thinking; the only difference is who steers.
@@ -20,8 +20,8 @@ one this tutorial keeps or ships.
20
20
 
21
21
  ### 1. Start from a founding implementation intent
22
22
 
23
- Create and board an intent the same way as track 1, stations 1 and 2: `plastic intent new`,
24
- then `plastic continue`. Describe something meant to grow into a small real project,
23
+ Create an intent and read where it stands, the same way as track 1, stations 1 and 2:
24
+ `plastic intent new`, then `plastic intent show ID`. Describe something meant to grow into a small real project,
25
25
  for example "build a personal todo app."
26
26
 
27
27
  Then type `plastic intent spec` and record a couple of real rulings on this founding
@@ -66,8 +66,10 @@ and an append-only, dated `## Log`. `INDEX.md` stays the single source of truth
66
66
  intent's status; the roadmap only mirrors it. List the two or more intents from station 3
67
67
  across one or more batches.
68
68
 
69
- Run `plastic roadmap check <slug>` to confirm the file parses, then `plastic roadmap show
70
- <slug>` to see it rendered as a report.
69
+ Run `plastic roadmap check <slug>` to confirm the file parses. A roadmap copied from the
70
+ template may have no `## Graph` section yet; `check` then exits 1 and names
71
+ `plastic roadmap migrate <slug>`, which writes the section from the batches. Then run
72
+ `plastic roadmap show <slug>` to see it rendered as a report.
71
73
 
72
74
  Artifact: a new `roadmaps/<slug>.md` file, sitting next to the project's `INDEX.md`, listing
73
75
  the two or more intents from station 3 across one or more batches.
@@ -101,13 +103,14 @@ sections you turned into the condition above.
101
103
  No command run here; describe the step instead. Each delivered intent's code merges to main
102
104
  as it lands. When the batch (or a meaningful slice of it) is ready to ship, cutting a release
103
105
  is a push to `alpha`, `beta`, or `main`: the version files are bumped in that push, and CI
104
- tags, publishes, and completes the intents it collects.
106
+ tags and publishes. CI never sees your stores, so it closes no intent: each intent is closed
107
+ with `plastic intent end ID --delivered --summary "TEXT"` after its code is merged.
105
108
 
106
109
  Releases and any npm publish step are described here, not run: this walkthrough stays in a
107
110
  sandbox and never touches a real package registry.
108
111
 
109
- Checkpoint: explain why a release completes the intents it collects, rather than an intent
110
- waiting on a release to exist first.
112
+ Checkpoint: explain why an intent closes when its code is merged, rather than waiting on a
113
+ release to exist first.
111
114
 
112
115
  ## Wrap and where to go next
113
116