@zalom/plastic 2.0.0-alpha.21 → 2.0.0-alpha.22

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/PLASTIC.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > **This file is maintained by Plastic.** It is overwritten on update; do not edit it. Project
4
4
  > rules go in `AGENTS.md`. Deeper doctrine lives in the six `plastic-conventions` chapters
5
5
  > (`references/<chapter>.md`: knowledge-graph, lifecycle-and-savepoints, locks-and-worktrees,
6
- > completion-and-done, maintenance-and-revisions, roadmaps), read on demand.
6
+ > completion-and-done, maintenance-and-revisions, roadmaps).
7
7
 
8
8
  ## Two Modes, Plus Auto
9
9
 
@@ -43,20 +43,20 @@ IDs follow Luhmann's alternating convention (`1`, `1a`, `1a1`, `1a1a`); siblings
43
43
 
44
44
  ## The Record: Stages as its Shape
45
45
 
46
- | Stage | Section | Deliverable | Skill |
47
- |---|---|---|---|
48
- | **What** | `## Intent` | `{ID}--{slug}.md` | `plastic-intent-creating` |
49
- | **Why** | `## Context` + Decisions | `spec.md` | `plastic-intent-speccing` (thinking mode) |
50
- | **How** | `checklist.md` + `actions/` | `plan.md` | `plastic-intent-speccing` writes the action files |
51
- | **Exec** | `## Outcome` | `outcome.md` | `plastic-intent-executing`; `plastic-intent-ending` closes |
46
+ | Stage | Section | Skill |
47
+ |---|---|---|
48
+ | **What** | `## Intent` | `plastic-intent-creating` |
49
+ | **Why** | `## Context` + Decisions | `plastic-intent-speccing` (optional) |
50
+ | **How** | `graph.md` + `nodes/` | `plastic-intent-speccing` |
51
+ | **Exec** | `## Outcome` | `plastic-intent-executing` drives the runner loop; `plastic-intent-ending` closes |
52
52
 
53
- Stages are the shape of the record, not checkpoints: nothing blocks a write. Only "how to
54
- execute" (a checklist item plus its action) must exist before work; the rest is backfilled at
55
- intent end from what was recorded while working.
53
+ Stages are the shape of the record, not checkpoints: nothing blocks a write. Work runs on
54
+ `graph.md` and `nodes/`, driven by `runner step` (dispatch), `runner status` (read the
55
+ ledger), and `runner answer` (close a `needs_decision` node). `spec.md` stays optional;
56
+ `plan.md` and `checklist.md` exist only for a legacy intent with no `graph.md`.
56
57
 
57
58
  Invoke a skill for your harness: Claude Code uses the slash form (`/plastic-intent-creating`);
58
- Codex CLI uses a dollar prefix instead (`$plastic-intent-creating`), and may also select a skill
59
- implicitly by matching its description.
59
+ Codex CLI uses a dollar prefix instead (`$plastic-intent-creating`), and may also select a skill implicitly by matching its description.
60
60
 
61
61
  `## Insights` is the append-only log of durable discoveries from every stage, newest at the
62
62
  bottom, never prepended, each entry prefixed `{utc-iso8601} · {stage} · {author}`. Write
@@ -71,8 +71,8 @@ An auto team is `plastic-enforcer` (the lead) plus `plastic-executor`; models li
71
71
  Twenty skills, each `plastic-<name>`, listed by your harness. `plastic-doctor` checks
72
72
  installation health (core, store, and full scopes). `plastic-feedback` turns a Plastic quirk,
73
73
  bug, or feature idea into a redacted local report and a prefilled GitHub issue URL; only the
74
- user submits it. If the user hits one, offer to invoke the plastic-feedback skill yourself
75
- instead of waiting to be asked. A release is a collection of intents; `plastic-releasing`
74
+ user submits it. If the user hits one, offer to invoke the plastic-feedback skill yourself.
75
+ A release is a collection of intents; `plastic-releasing`
76
76
  runs the flow. A roadmap is an ordered, delivery-side collection; `plastic-roadmap` owns it.
77
77
 
78
78
  ## State System
@@ -108,8 +108,10 @@ the store root, so the id allocator and every 1.x store walker skip them.
108
108
  2. Artifacts go in the intent directory, never in `docs/plans/` or `docs/specs/`: code goes in
109
109
  the project, everything else in the intent. Capture observations in `## Insights`; at the
110
110
  end write `outcome.md` and `## Outcome`, and update INDEX.md.
111
- 3. State is derived from what exists: `outcome.md` present means done, so never write it
112
- before the checklist is fully checked. Status lives on checklist items, not intents.
111
+ 3. State is derived from what exists: `outcome.md` present means the intent is closed, so
112
+ never write it before every node in `graph.md` reaches a terminal status (checklist.md
113
+ fully checked, for a legacy intent). Status lives on graph nodes or checklist items,
114
+ never on intents.
113
115
  4. The global store is never pushed (`~/.plastic/` holds sensitive data); agent-created repos
114
116
  are private by default (`gh repo create --private`).
115
117
  5. Intents are created only via `plastic-intent-creating`, never hand-authored. It
@@ -137,5 +139,5 @@ treating work as new. Enola, or Serena when Enola is absent: prefer its symbol r
137
139
  Locks and worktrees exist only for auto teams. One team develops an intent at a time: a
138
140
  session-keyed `delivery.lock` in the intent directory, alive while its mtime lease is fresh.
139
141
  Code edits happen in the intent's worktree (`<repo>/.claude/worktrees/{id}--{slug}`, branch
140
- `plastic/{id}--{slug}`). "Done" is three signals that agree: INDEX `## Completed` or
141
- `## Abandoned`, `outcome.md`, and the savepoint `Done` line; INDEX wins on conflict.
142
+ `plastic/{id}--{slug}`). A terminal intent is three signals that agree: INDEX
143
+ `## Completed`/`## Abandoned`, `outcome.md`, and the terminal savepoint line; INDEX wins.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zalom/plastic",
3
- "version": "2.0.0-alpha.21",
3
+ "version": "2.0.0-alpha.22",
4
4
  "description": "Intent-driven idea development system for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/scripts/doctor.rb CHANGED
@@ -631,6 +631,11 @@ class Doctor
631
631
  # ReadySet's own require chain is 65,648 bytes, far past that budget.
632
632
  checks.concat(node_graph_checks(intent_dirs))
633
633
 
634
+ # unpromoted_rules (intent 341, G8, C37): an Insights entry tagged
635
+ # `rule:` (via `insight-append --rule`) is a promise the rule will make
636
+ # it into project doctrine. Advisory only.
637
+ checks.concat(unpromoted_rules_checks(intent_dirs, home: Dir.home))
638
+
634
639
  # cross_store_resolution — RESOLVES (not just shape-checks) every cross-store
635
640
  # `store:id` ref against the FULL store family via the relocation map
636
641
  # (relocation consulted first), closing the shape-only gap i1/i3/i4 leave open.
@@ -795,7 +800,11 @@ def done_signal_findings_for_dir(dir, label:, scope:, dirname:, terminal:, activ
795
800
  # written from the record by `scaffold-intent backfill`, so this is repairable and
796
801
  # reported as a fixable warn (backfilled_complete). Its exclusions go to their OWN
797
802
  # bucket so savepoint_operational's consumed/dead-row bookkeeping above never sees them.
798
- backfill_gaps = %w[spec.md plan.md].reject { |f| Savepoint.stage_file_present?(File.join(dir, f)) }
803
+ # A graph intent (real graph.md on disk) never carries spec.md or plan.md by design
804
+ # (D1, no ceremonies, intent 341): the graph IS the spec and the plan, so a missing one
805
+ # is never a gap here.
806
+ is_graph_intent = File.exist?(File.join(dir, "graph.md"))
807
+ backfill_gaps = is_graph_intent ? [] : %w[spec.md plan.md].reject { |f| Savepoint.stage_file_present?(File.join(dir, f)) }
799
808
  # Name whichever directory the intent actually used (post-execution
800
809
  # review, non-blocking 8), consistent with Savepoint.missing_for_stage:
801
810
  # a nodes/ directory on disk means the intent chose the node-graph
@@ -853,7 +862,7 @@ def check_done_signals(scopes: nil)
853
862
  projection = IndexProjection.analyze(store[:store_dir], index_path: store[:index])
854
863
  projection[:drift].each do |row|
855
864
  index_drift << "#{store[:scope]}: #{row[:id]} - INDEX says #{row[:index_status]}, " \
856
- "the ledger's last Done line says #{row[:ledger_status]}"
865
+ "the ledger's last line says #{row[:ledger_status]}"
857
866
  end
858
867
  end
859
868
 
@@ -1097,7 +1106,7 @@ def check_done_signals(scopes: nil)
1097
1106
  fix_hint: "For a live (Active) intent, rebuild the ledger via " \
1098
1107
  "Savepoint.rebuild_savepoint. Terminal (Completed/Abandoned) intents are immutable: " \
1099
1108
  "a phantom there stays advisory unless an explicit human grant authorizes the " \
1100
- "124a manual Done-bookend repair."
1109
+ "124a manual terminal-bookend repair."
1101
1110
  )
1102
1111
  end
1103
1112
 
@@ -1294,9 +1303,13 @@ end
1294
1303
  end
1295
1304
 
1296
1305
  INTENT_END_LIFECYCLE_FILES = %w[spec.md plan.md checklist.md outcome.md].freeze
1306
+ # A graph intent (D1, no ceremonies, intent 341) never carries spec.md, plan.md, or
1307
+ # checklist.md by design; the graph IS the spec and the plan. outcome.md stays mandatory.
1308
+ GRAPH_INTENT_LIFECYCLE_FILES = %w[outcome.md].freeze
1297
1309
 
1298
1310
  def intent_lifecycle_artifacts_check(intent_dir, disposition)
1299
- missing = INTENT_END_LIFECYCLE_FILES.select { |f| !Savepoint.stage_file_present?(File.join(intent_dir, f)) }
1311
+ files = File.exist?(File.join(intent_dir, "graph.md")) ? GRAPH_INTENT_LIFECYCLE_FILES : INTENT_END_LIFECYCLE_FILES
1312
+ missing = files.select { |f| !Savepoint.stage_file_present?(File.join(intent_dir, f)) }
1300
1313
  unless Savepoint.stage_file_present?(Savepoint.intent_file(intent_dir))
1301
1314
  missing = [File.basename(Savepoint.intent_file(intent_dir))] + missing
1302
1315
  end
@@ -1774,6 +1787,68 @@ end
1774
1787
  end
1775
1788
  end
1776
1789
 
1790
+ # --- Check: unpromoted rule: findings (intent 341, G8, C37) ---------------
1791
+ #
1792
+ # `insight-append --rule` tags an entry "... - rule: <text>". A tag is a
1793
+ # promise the rule will make it into project doctrine; until the exact
1794
+ # rule text shows up in some skills/conventions/references/*.md chapter,
1795
+ # it is only visible to a session that happens to read this one intent
1796
+ # file, and the next session repeats the mistake the rule names. Advisory
1797
+ # only (warn, never fail): a freshly tagged rule is not yet promoted by
1798
+ # design, and nothing here can auto-promote it (that is an editorial call,
1799
+ # not a mechanical one).
1800
+ RULE_ENTRY_RE = /—\s*rule:\s*(.+?)\s*\z/.freeze
1801
+
1802
+ def unpromoted_rules_checks(intent_dirs, package_root: PACKAGE_ROOT, home: nil)
1803
+ # The installed doctor runs from ~/.plastic/scripts, so PACKAGE_ROOT
1804
+ # (~/.plastic) has no skills/ directory: the conventions chapters install
1805
+ # to the agent home layout instead. `home` is caller-injected (never an
1806
+ # ENV read here) so this stays hermetic in tests; the real call site
1807
+ # passes the process's actual home directory.
1808
+ chapter_dirs = []
1809
+ if home
1810
+ chapter_dirs << File.join(home, ".claude", "skills", "plastic-conventions", "references")
1811
+ chapter_dirs << File.join(home, ".agents", "skills", "plastic-conventions", "references")
1812
+ end
1813
+ chapter_dirs << File.join(package_root, "skills", "conventions", "references")
1814
+
1815
+ chapters_text = chapter_dirs.select { |d| Dir.exist?(d) }
1816
+ .flat_map { |d| Dir.glob(File.join(d, "*.md")) }
1817
+ .map { |f| File.read(f) }
1818
+ .join("\n\n")
1819
+
1820
+ unpromoted = []
1821
+ intent_dirs.each do |d|
1822
+ md_path = File.join(d[:path], "#{d[:name]}.md")
1823
+ next unless File.exist?(md_path)
1824
+
1825
+ File.readlines(md_path).each do |line|
1826
+ m = line.chomp.match(RULE_ENTRY_RE)
1827
+ next unless m
1828
+
1829
+ rule_text = m[1].strip
1830
+ next if rule_text.empty?
1831
+
1832
+ unpromoted << "#{tilde(d[:path])}: #{rule_text}" unless chapters_text.include?(rule_text)
1833
+ end
1834
+ end
1835
+
1836
+ if unpromoted.empty?
1837
+ [check(
1838
+ category: "conventions", name: "unpromoted_rules", status: "pass",
1839
+ message: "Every tagged rule: finding is carried by a conventions chapter"
1840
+ )]
1841
+ else
1842
+ [check(
1843
+ category: "conventions", name: "unpromoted_rules", status: "warn",
1844
+ message: "#{unpromoted.size} tagged rule(s) not yet carried by any conventions chapter",
1845
+ details: unpromoted, fixable: false,
1846
+ fix_hint: "Promote the rule into the right skills/conventions/references/*.md chapter, " \
1847
+ "or drop the tag if the finding does not belong in doctrine"
1848
+ )]
1849
+ end
1850
+ end
1851
+
1777
1852
  # --- Check category 3: Agent registration ---
1778
1853
 
1779
1854