@softure-ai/skills 0.19.0 → 0.21.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/ONBOARD.md CHANGED
@@ -81,7 +81,7 @@ you escalate. Talk to me in <chat language>; everything you write to the reposit
81
81
  filed in SOFTURE/SKILLS; only a release or a production deploy waits for my word;
82
82
  - for a hosted project (claude.ai project) whose instructions lack it, the pointer from
83
83
  WORKFLOW §8.5 with <owner>/<repo> filled in, ready to paste.
84
- 6. Then follow "Start of a run" from AGENTS.md: adopt what is in flight first (give the go to READY
84
+ 6. Then follow "Start of a run" from AGENTS.md: act on open `owner-word` issues first, then adopt what is in flight (give the go to READY
85
85
  threads, nudge stalled ones), then start threads for ready, parallel-safe items, then the report
86
86
  routine. With no roadmap and no issue queue, say so in one line and name what I give next (a
87
87
  goal for `softure-shape`, or an issue queue); do not invent work.
package/README.md CHANGED
@@ -24,10 +24,53 @@ What the installer does (idempotent; re-run on every `npm install`):
24
24
  | `rules/AGENTS.md` | managed block in `AGENTS.md` (or `CLAUDE.md` if only that exists) |
25
25
  | ignore entries | managed block in `.gitignore`: installed skills are restored by `npm install`, not committed |
26
26
  | manifest | `.claude/softure-skills.json` |
27
+ | label `owner-word` | created on the forge when an authenticated `gh` can (outside CI); otherwise the command is printed |
27
28
 
28
29
  It never overwrites a skill folder it did not install. Flags: `--dry-run`, `--target <dir>`,
29
30
  `--no-gitignore` (commit the skills instead).
30
31
 
32
+ **CI line.** Add one step to the project's CI check, documentation-only changes included (in a project
33
+ that already has history, once the rollout below brings the doctor to zero):
34
+
35
+ ```bash
36
+ npx softure-skills doctor
37
+ ```
38
+
39
+ It fails on drift in `context/` (a roadmap left after its archive, archived changes not stamped,
40
+ `## Summary` placeholders, a stale `context/state.json`, …; WORKFLOW §12). The installer prints the
41
+ line until a workflow runs it. `npx softure-skills state` regenerates `context/state.json`, which the
42
+ scripts otherwise write themselves.
43
+
44
+ **Rolling out to an existing project** (WORKFLOW §12.4). A project that adopted the package earlier
45
+ usually fails on history. Put it right, in this order, one pass per repository:
46
+
47
+ 1. `npx softure-skills doctor --fix`, then `--fix --write`: the mechanical repairs (archived change
48
+ statuses, with the old value kept as `legacy_status`; archive index links to moved files). Commit.
49
+ 2. `npx softure-skills doctor --sweep --json`, worked by an agent with the `softure-doctor` skill
50
+ ("Sweep history to zero"): every entry settled with its evidence (commit, release, file), never
51
+ without, in one change, until the doctor exits 0.
52
+ 3. The owner's short list: only real owner items (an open decision, a step outside the repository),
53
+ carried to the live roadmap or an `owner-word` issue.
54
+ 4. The CI line above, once the doctor is at zero.
55
+
56
+ `npx softure-skills doctor --baseline` exists only as a last resort, for a project that cannot finish
57
+ the history sweep at once: it accepts today's failures in `context/doctor-baseline.json`, the check
58
+ then fails on anything new, and the file only shrinks. The recommended path is the sweep to zero.
59
+
60
+ ## Many projects at once
61
+
62
+ `npx softure-skills portfolio` is read-only: it reads `context/state.json` from the main branch of every
63
+ listed repository (arguments, or `~/.config/softure/portfolio.json` outside any project) and prints one table:
64
+
65
+ ```
66
+ | project | active roadmap X/N | queued | open changes | owner queue | last release | doctor |
67
+ ```
68
+
69
+ `--owner` prints only what waits for the owner across all projects, oldest first; `--json` gives the same
70
+ data to another tool; `--source api` reads through the GitHub API instead of git. The last release comes
71
+ from the forge (the latest GitHub release through `gh`, else the highest `v*` tag); a value only a roadmap
72
+ recorded is labelled `(roadmap)`. See WORKFLOW §12.3.
73
+
31
74
  **Operating mode.** `context/workflow.json` → `mode` is `"manual"` (default) or `"autonomous"`, and the
32
75
  installer injects only that mode's section into the rules block:
33
76
 
@@ -95,6 +138,7 @@ operating modes.
95
138
  | | `softure-lesson` | numbered rule in `lessons.md` |
96
139
  | | `softure-rule-review` | audit of AGENTS.md / CLAUDE.md / skills |
97
140
  | | `softure-evidence` | screenshots and recordings in the evidence store (never git) + the evidence page |
141
+ | | `softure-doctor` | `context/state.json` (machine-readable state, `owner_queue`) + the `context/` contract check |
98
142
 
99
143
  Every interactive skill accepts `--auto`: it decides instead of asking and records each
100
144
  decision in the artifact. The orchestrators always use it, and `mode: "autonomous"` implies it.
package/WORKFLOW.md CHANGED
@@ -25,6 +25,7 @@ hygiene (any time)
25
25
  softure-rule-review audit AI rule files (AGENTS.md, CLAUDE.md, skills) for drift and contradictions
26
26
  softure-lesson turn a repeated mistake into a numbered rule
27
27
  softure-evidence store screenshots and recordings outside git, by name, on one evidence page (§11)
28
+ softure-doctor check the context/ contract and keep context/state.json current (§12)
28
29
  ```
29
30
 
30
31
  Each step produces a durable artifact the next step reads. A step never starts without its
@@ -149,14 +150,17 @@ Parallel sessions push often, and every push can start the project's CI. The ski
149
150
  The project's side: when the git hooks already run the gates (`pre-commit`, `pre-push`), CI does not need to
150
151
  repeat them on every pushed branch. A pre-push hook needs a cheap path for a push whose changed files are all
151
152
  under `context/` (the roadmap commits of `wt-roadmap.py`): skip typecheck, lint and tests, keep the language
152
- check. Without it every stage costs a full suite, which is what `cloudState: "branch"` works around. Run CI on pull requests, on the main branch or on demand, skip changes
153
- that touch only documents, and cancel superseded runs (`concurrency`).
153
+ check. Without it every stage costs a full suite, which is what `cloudState: "branch"` works around. Run CI on pull requests, on the main branch or on demand, skip
154
+ the gates for changes that touch only documents, and cancel superseded runs (`concurrency`). The one step that
155
+ does run on documentation-only changes is `npx softure-skills doctor` (§12): it takes seconds and checks exactly
156
+ the files those changes edit.
154
157
 
155
158
  ## 3. Artifacts
156
159
 
157
160
  ```
158
161
  context/
159
162
  workflow.json
163
+ state.json machine-readable project state, written by scripts only (§12)
160
164
  foundation/
161
165
  shape-notes.md softure-shape (frontmatter: session, status, context_type: greenfield | brownfield, created, updated; optional `## Frame` from softure-frame)
162
166
  prd.md softure-prd (frontmatter: version, status: draft | accepted, context_type, source, updated)
@@ -372,6 +376,12 @@ the end", otherwise by the owner). Gates, all checked on `<main>` and reported t
372
376
  when one exists; otherwise the summary records `integration: covered by the release on <sha>
373
377
  (coveredByRelease)`. The release's integration result gates the deploy, not the archive; its reds become new
374
378
  roadmap rows as usual.
379
+ 4. no open `- [ ]` under `## Owner decisions and checks`: the close **refuses** to archive with one. Each entry is
380
+ ticked with its evidence (`— done: <sha | release | path>`), ticked as obsolete (`— obsolete: <reason>`), or
381
+ carried to the next or a queued roadmap's owner section, or an `owner-word` issue (§8.6), and ticked with where it
382
+ went (`— carried to <path | #N>`). An archived roadmap holds no owner entry: the owner queue never reads one
383
+ (§12.1), and the doctor fails on it (`archived-roadmap-open-checks`). Open `## Before the next release` steps
384
+ stay: they wait for the release, which comes after the close.
375
385
 
376
386
  **Close before the release.** The release reads the roadmap to list what ships, so the archived file is the single
377
387
  stable input for every release of that roadmap: the first attempt, a retry after a failed release, a redeploy or a
@@ -382,13 +392,17 @@ the release keep `done_code` in the archived `## At a glance`, so the release st
382
392
  Then, in one commit (`docs(roadmap): close <slug>`):
383
393
 
384
394
  - move `roadmap.md` to `foundation/archive/<YYYY-MM-DD>-roadmap.md` (same-day collision: `-2`, `-3`, never other
385
- suffixes) and append `## Summary`: one table `| ID | Item | What changed | Merge |` (merge SHA per row) and the
386
- integration result line. It is the version history; release notes can be built from it;
395
+ suffixes) and append `## Summary`: one table `| ID | Item | What changed | Merge |` (merge SHA per row, `—` for a
396
+ carried or dropped row, never a placeholder) and the integration result line. It is the version history; release
397
+ notes can be built from it. The release that ships it may add one line `Release: <version> (<YYYY-MM-DD>)` under
398
+ the summary; `context/state.json` reports the newest one as `last_release`;
387
399
  - carried rows move to the next roadmap or to a queued one, never silently dropped;
388
400
  - if this roadmap was promoted from `roadmaps/roadmap-<slug>.md`, remove its backlog folder
389
401
  `backlog/roadmap-<slug>/` (move entries that are still alive to another queued roadmap first) and its row in an
390
402
  index file such as `foundation/roadmaps/README.md`, if the project keeps one;
391
- - afterwards: every file in `roadmaps/` is a waiting roadmap, and every folder in `backlog/` has its roadmap file.
403
+ - afterwards: every file in `roadmaps/` is a waiting roadmap, and every folder in `backlog/` has its roadmap file;
404
+ - right before the commit: `context_state.py write --staged` (the state goes into the same commit) and
405
+ `doctor.py`; a failure the close owns is fixed, any other is named in the report (§12).
392
406
 
393
407
  ## 6. `plan.md`
394
408
 
@@ -593,6 +607,25 @@ the set. It never derives the next start only from the thread that just merged.
593
607
  scoped to the project's own repository: attach a repository the run needs (for example SOFTURE/SKILLS
594
608
  to file a gap) before deciding it is out of reach.
595
609
 
610
+ ### 8.6 Owner-word issues
611
+
612
+ The owner often decides for a project from outside its chat, for example while reviewing several projects at once
613
+ (`softure-skills portfolio --owner`, §12.3). Such a decision travels as an issue in the project's own repository,
614
+ labelled **`owner-word`**: one decision, its scope and any limit ("start the queued roadmap payments", "release only
615
+ after the last item", "drop SA-12"). It is the owner's word in writing, equal to the same sentence in the main chat.
616
+
617
+ - **Label.** The installer creates `owner-word` when the forge allows it (GitHub through an authenticated `gh`,
618
+ outside CI); otherwise it prints the one command that creates it.
619
+ - **Autonomous mode.** The coordinator lists open `owner-word` issues first at the start of a run and again on every
620
+ report and wake-up, and acts on each like an order in the chat: a roadmap to start goes through a roadmap thread,
621
+ a release word is recorded where the release rules look for it, a "no" or "later" is recorded in the roadmap. It
622
+ comments what it did (thread, PR, merge SHA) and closes the issue; one it cannot act on (unclear, contradicts
623
+ `change.md` or a standing order) gets a comment with the question and stays open.
624
+ - **Manual mode.** The coordinator shows open `owner-word` issues to the owner at the start of a session and acts
625
+ only on the owner's word in the conversation; it then comments and closes them the same way.
626
+ - **Not in `state.json`.** Open owner-word issues live on the forge; an aggregator reads both (`state.json` for what
627
+ waits for the owner, the forge for the words already given).
628
+
596
629
  ## 9. Commits
597
630
 
598
631
  - Implementation: `<type>(<change-id>): <phase title> (p<N>)`. Type is `feat`, `fix`, `refactor`,
@@ -600,7 +633,7 @@ to file a gap) before deciding it is out of reach.
600
633
  - Review fixes: `fix(<change-id>): address impl review`.
601
634
  - Progress bookkeeping (when no later commit of the change carries it): `docs(<change-id>): progress p<N>`.
602
635
  - Archive: `chore(archive): close <change-id>`.
603
- - Roadmap stage updates: `docs(roadmap): <ID> <stage>`.
636
+ - Roadmap stage updates: `docs(roadmap): <ID> <stage>` (they carry `context/state.json`, §12).
604
637
  - Lessons: `docs(lessons): L-<NNN> <title>`. Rule-file edits: `docs(rules): <what>`.
605
638
  - Merge of a worktree branch: `Merge <change-id> (<ID>): <outcome>`.
606
639
 
@@ -666,3 +699,174 @@ concepts, private data and design material, in one layout:
666
699
  `softure-evidence` (`scripts/evidence.py`) does the naming, the conversion, the store and the page:
667
700
  `save`, `list`, `render`, `check`, `prune`. Without a configured store it keeps a local copy, reports it
668
701
  as not durable, and the setup gap goes to the owner once.
702
+
703
+ ## 12. Project state (`context/state.json`) and the doctor
704
+
705
+ An owner who runs several projects reads one file per repository instead of parsing the roadmap, the queued
706
+ roadmaps, the change folders and the owner sections by hand. The same file and one check keep `context/`
707
+ from drifting out of the contract unnoticed.
708
+
709
+ ### 12.1 `context/state.json`
710
+
711
+ Written **only by scripts**, never by hand, always in the same commit as the markdown it reflects:
712
+
713
+ | Writer | When |
714
+ | --- | --- |
715
+ | `wt-roadmap.py` | every mode (`open`, `stage`, `ready`, `done`, `done_code`), together with `roadmap.md` |
716
+ | `softure-archive` | on the main branch, before its commit (with `--handoff` the branch leaves it alone; `wt-roadmap.py done` writes it after the merge) |
717
+ | `softure-roadmap` | record, `--revise`, `--queue`, `--promote`, `--close`, before its commit |
718
+
719
+ The skills run `python3 .claude/skills/softure-doctor/scripts/context_state.py write --staged`: it reads what is
720
+ staged (so nobody's uncommitted edits leak in) and stages the result. By hand: `npx softure-skills state`.
721
+ A project without the file gets it from the first of these runs; nothing has to be migrated.
722
+
723
+ ```jsonc
724
+ {
725
+ "schema_version": 1,
726
+ "project": "Example clinic", // workflow.json `project`, else the roadmap's `project`
727
+ "mode": "autonomous", "main_branch": "main",
728
+ "updated_at": "2026-11-20T09:00:00Z", // changes only when the content does
729
+ "active_roadmap": { // null when there is no roadmap.md
730
+ "slug": "search", "title": "…", "status": "ready", "version": "2", "path": "context/foundation/roadmap.md",
731
+ "done": 2, "total": 5, // done = rows done or done_code (the report's X of N)
732
+ "items": [ // rows not done yet
733
+ { "id": "SR-2", "change_id": "search-titles", "outcome": "…", "status": "in_progress",
734
+ "stage": "implement 2/3", "since": "2026-11-08", "detail": "…", "prerequisites": ["SR-1"], "mode": "autonomous" }
735
+ ]
736
+ },
737
+ "queued": [ { "slug": "payments", "path": "…", "status": "waiting", "start_condition": "<trigger>",
738
+ "done": 0, "total": 1, "items": [ { "id": "PY-1", "change_id": "…", "outcome": "…", "status": "blocked" } ] } ],
739
+ "open_changes": [ { "change_id": "search-titles", "title": "…", "status": "implementing", "roadmap_item": "SR-2",
740
+ "updated": "2026-11-10", "stage": "implement 2/3" } ],
741
+ "owner_queue": [ // everything that waits for the owner, oldest first
742
+ { "kind": "decision", "source": "context/foundation/roadmap.md#Owner decisions and checks", "item": "SR-5",
743
+ "since": "2026-11-10", "text": "**SR-5**: choose the ranking provider …" }
744
+ ],
745
+ "last_release": { "version": "v1.4.0", "date": "2026-10-02", // as a closed roadmap recorded it (§5.2); the
746
+ "source": "context/foundation/archive/2026-09-30-roadmap.md" } // portfolio asks the forge first
747
+ }
748
+ ```
749
+
750
+ The schema ships with the package: `skills/softure-doctor/references/state.schema.json`.
751
+
752
+ **`owner_queue`** is the one list of what waits for the owner, built only from what is live: the main roadmap, the
753
+ queued roadmaps, the open changes, and the pre-release steps of the newest closed roadmap until its release is
754
+ recorded:
755
+
756
+ | `kind` | Comes from |
757
+ | --- | --- |
758
+ | `word` | rows `done_code (…; waiting: release)` of the main roadmap (one entry: the release word); every queued roadmap (the word to start it, with its `trigger`) |
759
+ | `decision` | open `- [ ]` entries under `## Owner decisions and checks` that are not owner steps |
760
+ | `step` | `owner step:` entries and manual-mode owner checks `(Manual N.M)`; open `## Before the next release` entries; `done_code` rows waiting for an owner step that has no entry; `**Owner step:**` / `**Owner check:**` lines of an open change's `## Roadmap handoff` |
761
+ | `secret` | a `step` whose text names a secret, key, token, credential or password |
762
+
763
+ An archived roadmap contributes nothing, with one exception: the newest one, while its `## Summary` records no
764
+ `Release:` line, contributes its open `## Before the next release` steps (the close comes before the release, §5.2).
765
+ An unticked entry in any other archived roadmap, and any unticked `## Owner decisions and checks` entry in an archived
766
+ roadmap, is history to settle (the doctor's `archived-roadmap-open-checks`), not something that waits for the owner.
767
+ Entries from open changes are refreshed on every write and never make the file stale, like `open_changes`. `source` is the file, `#`, and the heading; `item` the roadmap ID the entry names;
768
+ `since` the date in the entry, else the file's `updated`, and once written it is kept for that entry on every
769
+ rewrite. Owner-word issues (§8.6) live on the forge, not here.
770
+
771
+ `open_changes` and `updated_at` are refreshed on every write but never make the file stale: a change branch edits
772
+ its own `change.md` without touching `state.json`, and stays green.
773
+
774
+ ### 12.2 `softure-doctor`
775
+
776
+ `npx softure-skills doctor` (or `python3 .claude/skills/softure-doctor/scripts/doctor.py`) exits non-zero on:
777
+
778
+ | Code | Drift |
779
+ | --- | --- |
780
+ | `roadmap-archived-not-removed` | `roadmap.md` is still there although the same roadmap (slug and version) is in `foundation/archive/` |
781
+ | `roadmap-status-mismatch` | `roadmap.md` says `done` while rows are open, or `waiting` (a queued roadmap's status) |
782
+ | `archived-change-status` | an archived `change.md` whose status is not `archived` |
783
+ | `archived-change-progress` | an archived `plan.md` with unticked Automated items (open Manual items are legitimate) |
784
+ | `archived-roadmap-open-items` | an archived roadmap with rows that are not `done`, `done_code`, dropped or carried |
785
+ | `archived-roadmap-summary` | an archived roadmap whose `## Summary` merge column holds placeholders instead of SHAs |
786
+ | `archived-roadmap-open-checks` | an archived roadmap with an unticked `## Owner decisions and checks` entry, or an unticked `## Before the next release` step once its release is recorded or a later roadmap was closed |
787
+ | `queued-roadmap-done` | a queued roadmap whose rows are all done, never archived |
788
+ | `backlog-without-roadmap` | `backlog/roadmap-<slug>/` without `roadmaps/roadmap-<slug>.md` (or the promoted main roadmap) |
789
+ | `index-missing-file` | a table row of a `README.md` or `INDEX.md` under `context/` that links or names a missing file |
790
+ | `state-missing` | `context/state.json` is gone although git history holds it |
791
+ | `state-stale` | `context/state.json` does not match the markdown |
792
+ | `baseline-stale` | `context/doctor-baseline.json` lists a failure that no longer occurs (remove it), or is unreadable |
793
+
794
+ **Mechanical repairs.** `npx softure-skills doctor --fix` prints the edits that need no judgement, and the failures
795
+ left after them; `--fix --write` applies them, only under `context/`, and a second run changes nothing:
796
+
797
+ - an archived change's `status` becomes `archived`; the old value is kept as `legacy_status` in its front matter;
798
+ - an index row inside `context/archive/` or `context/foundation/archive/` that links a missing file is rewritten to
799
+ the file's current path when git history shows where it moved (rename detection, followed across moves);
800
+ otherwise it is marked `(moved, not found; last seen in <sha>: <path>)` with the last commit that had the file.
801
+
802
+ A row whose target was never in git history, a live index, and a checkout without full history are left alone and
803
+ named. Everything else is a judgement case.
804
+
805
+ **Judgement cases: the sweep.** `npx softure-skills doctor --sweep [--json]` (read-only) lists every remaining failure
806
+ as one worklist entry per thing to settle (an unticked Progress item, a `## Summary` placeholder, an open row, an open
807
+ owner check), with `path`, `line`, the exact `text`, and evidence pointers found in the repository alone: for unticked
808
+ Progress items the commits that touched the phase's files after the plan's date (and the SHA the phase's ticked items
809
+ cite); for `## Summary` placeholders the merge commit of the item's change (first-parent log, branch name, change ID in
810
+ the message); for open rows and owner checks the item's archived change, merge commit, the release that contains it,
811
+ and later roadmaps that mention the item. An entry with no evidence is marked `owner`. The `softure-doctor` skill
812
+ ("Sweep history to zero") tells an agent how to work it: every entry is settled with its evidence written into the line,
813
+ never without; what only the owner can settle (a real open decision, a step outside the repository) is carried to the
814
+ live roadmap's `## Owner decisions and checks` or an `owner-word` issue and collected in one short list for the owner;
815
+ nothing else is left open.
816
+
817
+ **Baseline: a last resort.** For a project that cannot finish the sweep at once, `doctor --baseline` writes the failures
818
+ that remain to `context/doctor-baseline.json` (`{ "note", "created", "entries": [ { "code", "path", "message" } ] }`).
819
+ The check then reports those as `baselined` and fails only on a new failure (a code and path not in the file) and on an
820
+ entry that was fixed but not removed (`baseline-stale`). The file only shrinks: running `--baseline` again drops the
821
+ fixed entries, never adds one (it names them and exits 1), and removes the file once it is empty. State findings are
822
+ never baselined; `--fix` and `--sweep` ignore it. It is the owner's call, recorded in the commit; the recommended path
823
+ is the sweep to zero.
824
+
825
+ A project that has never written `state.json` gets a note, not a failure. **Adopting projects run the doctor in their
826
+ CI check**, documentation-only changes included; the installer prints the line (`npx softure-skills doctor`) until a
827
+ workflow under `.github/workflows/` runs it. `softure-archive` and `softure-roadmap --close` run it before their commit
828
+ and fix what they own.
829
+
830
+ ### 12.3 Portfolio: many projects at once
831
+
832
+ `npx softure-skills portfolio` reads the state of several projects and writes nothing anywhere (a remote is read
833
+ through a shallow, sparse clone into a temporary folder; a local checkout at `origin/<mainBranch>` without a fetch).
834
+
835
+ ```bash
836
+ npx softure-skills portfolio acme/shop ~/code/api # or list them in ~/.config/softure/portfolio.json
837
+ npx softure-skills portfolio --owner # only the owner queue, oldest first
838
+ npx softure-skills portfolio --json # the same data for another tool
839
+ ```
840
+
841
+ The config file lives outside every project (`--config <file>`, `$SOFTURE_PORTFOLIO`, default
842
+ `~/.config/softure/portfolio.json`): `{ "projects": [ { "name": "shop", "repo": "acme/shop", "branch": "main" } ] }`,
843
+ where `repo` is `owner/name`, a git URL or a local path. One row per project:
844
+ `project | active roadmap X/N | queued | open changes | owner queue | last release | doctor`. The doctor runs on the
845
+ same tree; a project without `state.json` yet gets one built in memory (marked `*`). `--source api` reads only
846
+ `state.json` through `gh api` (no doctor). **Last release comes from the forge** when it can: the latest GitHub
847
+ release through `gh api` (both modes, for a GitHub repository; a local checkout counts when its `origin` is on GitHub),
848
+ else the highest `v*` tag (git mode), else `state.json` → `last_release`, which only records what a closed roadmap
849
+ wrote and is shown labelled: `v1.4.0 (roadmap, 2026-10-02)`. `--json` gives `last_release`, `last_release_date` and
850
+ `last_release_source` (`release`, `tag` or `roadmap`).
851
+
852
+ ### 12.4 Rolling out the doctor to an existing project
853
+
854
+ A project that adopted the package before the doctor existed usually fails on history: archived changes with old
855
+ status values, archive indexes that link moved files, unticked Progress items and owner checks in roadmaps closed
856
+ long ago. The history is put right, not hidden. One pass per repository, in this order:
857
+
858
+ 1. **Mechanical fixes.** Update the package, then `npx softure-skills doctor --fix` (review the printed edits) and
859
+ `npx softure-skills doctor --fix --write`. Commit: `docs(context): mechanical history fixes (doctor --fix)`.
860
+ 2. **The sweep, worked by an agent.** `npx softure-skills doctor --sweep --json`, settled entry by entry as the
861
+ `softure-doctor` skill describes ("Sweep history to zero"): every tick, SHA, status and obsolete mark carries its
862
+ evidence (commit, release, file), never without. Regenerate the state, re-run the doctor until it exits 0, and land it
863
+ as one change: `docs(context): settle history to zero`.
864
+ 3. **The owner's list.** What only the owner can settle (a decision still open, a step outside the repository that
865
+ nothing shows done) was carried to the live roadmap's `## Owner decisions and checks` or an `owner-word` issue; the
866
+ agent's report lists it once, short: `ID | what the owner decides or does | where it lives now`. Nothing else
867
+ waits, so `portfolio --owner` shows only these and the live roadmaps' entries.
868
+ 4. **The CI line at zero.** Once `npx softure-skills doctor` exits 0 on the main branch, add it to the CI check
869
+ (documentation-only changes included). From then on every new drift is red where it happens.
870
+
871
+ A project that cannot finish step 2 in one change may, on the owner's word, use `doctor --baseline` (§12.2) and add the
872
+ CI line with it; the baseline only shrinks, and the sweep continues until the file is gone.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softure-ai/skills",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "SOFTURE agent skills: a spec-driven delivery workflow (shape → prd → roadmap → plan → implement → review) plus parallel worktree orchestration",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,6 +15,7 @@
15
15
  "ONBOARD.md",
16
16
  "scripts/install.mjs",
17
17
  "scripts/uninstall.mjs",
18
+ "scripts/portfolio.py",
18
19
  "README.md"
19
20
  ],
20
21
  "bin": {
package/rules/AGENTS.md CHANGED
@@ -33,7 +33,12 @@ The full contract is in `node_modules/@softure-ai/skills/WORKFLOW.md`.
33
33
  `softure-implement` → `softure-impl-review` → `softure-archive`.
34
34
  - **In parallel:** `softure-worktree` runs one change end to end in its own worktree.
35
35
  `softure-worktree-manager` runs several at once and merges them.
36
- - **Any time:** `softure-code-review`, `softure-rule-review`, `softure-lesson`.
36
+ - **Any time:** `softure-code-review`, `softure-rule-review`, `softure-lesson`, `softure-doctor`.
37
+
38
+ `context/state.json` is the machine-readable state of the project (WORKFLOW §12). Only scripts write
39
+ it (`wt-roadmap.py`, and `context_state.py write --staged` in `softure-archive` and `softure-roadmap`),
40
+ in the same commit as the markdown; never edit it by hand. CI runs `npx softure-skills doctor`, which
41
+ fails on drift in `context/`: fix the file it names, never the check.
37
42
 
38
43
  **Every change goes through the chain, however small.** A one-line fix reported in chat is a change
39
44
  too (`roadmap_item: null`). `new`, `plan`, `plan-review`, `implement`, `impl-review` and `archive` are
@@ -79,6 +84,9 @@ step the owner has to undo.
79
84
  batch before launching and asks before every merge.
80
85
  - **Questions are welcome.** When a decision is the owner's (scope, product behaviour, naming, a
81
86
  trade-off), ask with a recommendation instead of deciding silently.
87
+ - **Owner-word issues** (label `owner-word`, WORKFLOW §8.6): at the start of a session, list the open
88
+ ones in this project's repository and show them to the owner first, with what each would start. Act
89
+ on one only after the owner's word in this conversation; then comment what was done and close it.
82
90
  - Rules of autonomous projects (standing merge consent, coordinators, report cadences) do not apply
83
91
  here, even when a memory or another session suggests them.
84
92
 
@@ -133,6 +141,9 @@ the owner's to-do.
133
141
  **Start of a run.** A coordinator that wakes with no run in flight (a fresh or cleared session, or a
134
142
  hosted project's main-chat session on its first message) starts the run itself, without waiting for
135
143
  the owner's "go":
144
+ 0. **owner-word issues first:** list the open issues labelled `owner-word` in this project's repository
145
+ (through a thread when the coordinator has no forge access) and act on each before starting any other
146
+ thread (Owner-word issues, below);
136
147
  1. read `context/workflow.json` and the roadmap (or the issue queue) on the main branch; outside a
137
148
  checkout, read them, and this block, from the repository first. Then read the project's memory and
138
149
  its own coordinator conventions (the project's `AGENTS.md` outside this block). When memory lacks
@@ -189,6 +200,8 @@ Only a "stop" or "pause" from the owner, recorded in memory, holds it back.
189
200
  - **Stale go:** a thread that got its go and has sent no merge SHA within 30 minutes is nudged at once
190
201
  (what is it waiting for, CI or a conflict?), not at the next report.
191
202
  - Posts every thread's result in the main chat as it arrives (condensed, decision first).
203
+ - **Checks open `owner-word` issues on every report and every wake-up**, before the startable set, and
204
+ acts on new ones (Owner-word issues, below).
192
205
  - **Makes sure finished threads are closed.** On every merge result, and whenever a thread with a
193
206
  one-off job hands its result over (a planning thread, the report routine setup thread once it sends
194
207
  the routine id back, a report thread), check that the thread is resolved and resolve it yourself
@@ -327,6 +340,18 @@ the owning repository first (read and issues) and only then decide you cannot fi
327
340
  of reach, put the issue text in the main chat for the owner. The work goes on around it; the item that
328
341
  needs the fix is `blocked (<repo>#<N>)`.
329
342
 
343
+ **Owner-word issues.** An open issue labelled `owner-word` in this project's repository is the owner's
344
+ word in writing, equal to the same sentence in the main chat: one decision, its scope and any limit
345
+ ("start the queued roadmap payments", "release after the last item", "drop SA-12"). The coordinator acts
346
+ on it like an order in the chat: a roadmap to start goes to a roadmap thread (`--promote`), a release
347
+ word is recorded where the release rules look for it (the roadmap header's `Release:` order, quoted with
348
+ the issue link), a "no" or "later" is recorded in the roadmap (`## Owner decisions and checks` or the
349
+ item's status). Then it comments what it did (thread, PR, merge SHA, roadmap line), closes the issue as
350
+ completed, and names it in the next report. An issue it cannot act on (unclear, contradicts `change.md`
351
+ or a standing order) gets one comment with the question and stays open; the question also goes to the
352
+ owner in the main chat. Owner-word issues are not work items: they never get a thread of their own
353
+ unless the decision itself needs one, and they are not in `context/state.json`.
354
+
330
355
  **Issues as the work source** (`autonomy.source: "issues"`, no roadmap):
331
356
  - The coordinator lists open issues (through a thread when it has no forge access). Not well-founded:
332
357
  comment why, label `invalid`, close. Well-founded: one change, one thread.
@@ -7,6 +7,14 @@
7
7
  //
8
8
  // Flags: --postinstall (never fails the host install), --dry-run, --target <dir>, --no-gitignore
9
9
  //
10
+ // Subcommands (run from the project root; Python 3, like the other scripts):
11
+ // softure-skills doctor [--json] check the context/ contract (WORKFLOW.md §12); exit 1 on drift
12
+ // softure-skills doctor --fix [--write] mechanical repairs of history (dry run unless --write)
13
+ // softure-skills doctor --sweep [--json] worklist of the judgement cases, with evidence (read-only)
14
+ // softure-skills doctor --baseline last resort: accept today's failures; the file only shrinks
15
+ // softure-skills state [write|print|check] regenerate context/state.json (default: write)
16
+ // softure-skills portfolio [<repo> ...] [--owner] [--json] read-only table across many repositories
17
+ //
10
18
  // Per-project choices live in context/workflow.json -> "install" (all optional):
11
19
  // "gitignore": false commit the installed skills instead of ignoring them
12
20
  // "rules": ["workflow", ...] rule sections to inject; default: every section in RULE_SECTIONS
@@ -14,6 +22,7 @@
14
22
  // section that is always injected, whatever "rules" says. The "language" section is mandatory too:
15
23
  // only "allowNonEnglishCode": true (an owner's explicit exception) leaves it out.
16
24
 
25
+ import { spawnSync } from "node:child_process";
17
26
  import fs from "node:fs";
18
27
  import path from "node:path";
19
28
  import { fileURLToPath } from "node:url";
@@ -32,6 +41,54 @@ const RULE_SECTIONS = { language: "## Language", workflow: "## How work flows",
32
41
  const MODE_HEADING = "## Operating mode: ";
33
42
  const MODES = ["manual", "autonomous"];
34
43
  const DEFAULT_MODE = "manual";
44
+ const DOCTOR_SCRIPTS = path.join(PACKAGE_ROOT, "skills", "softure-doctor", "scripts");
45
+ // Subcommand -> [script, default arguments]. Each runs with the caller's working directory.
46
+ const SUBCOMMANDS = {
47
+ doctor: [path.join(DOCTOR_SCRIPTS, "doctor.py"), []],
48
+ state: [path.join(DOCTOR_SCRIPTS, "context_state.py"), ["write"]],
49
+ portfolio: [path.join(PACKAGE_ROOT, "scripts", "portfolio.py"), []],
50
+ };
51
+ const CI_LINE = "npx softure-skills doctor";
52
+ // Issues with this label carry an owner decision the coordinator acts on (WORKFLOW.md §8.6).
53
+ const OWNER_WORD_LABEL = {
54
+ name: "owner-word",
55
+ color: "5319e7",
56
+ description: "An owner decision the coordinator acts on (SOFTURE workflow)",
57
+ };
58
+ const LABEL_COMMAND = `gh label create ${OWNER_WORD_LABEL.name} --color ${OWNER_WORD_LABEL.color} --description "${OWNER_WORD_LABEL.description}"`;
59
+
60
+ // Creates the owner-word label on the project's forge when it can (GitHub through an authenticated gh,
61
+ // outside CI, once per checkout). Returns [action line, whether the label is known to exist].
62
+ function ensureOwnerWordLabel(projectRoot, previous, options) {
63
+ if ((previous.labels ?? []).includes(OWNER_WORD_LABEL.name)) return [null, true];
64
+ if (options.isDryRun) return [`label ${OWNER_WORD_LABEL.name} (created on the forge when gh can)`, false];
65
+ if (process.env.CI) return [null, false];
66
+ const result = spawnSync("gh", ["label", "create", OWNER_WORD_LABEL.name, "--color", OWNER_WORD_LABEL.color,
67
+ "--description", OWNER_WORD_LABEL.description], { cwd: projectRoot, encoding: "utf8", timeout: 15000 });
68
+ if (result.status === 0) return [`label ${OWNER_WORD_LABEL.name} created on the forge`, true];
69
+ if (/already exists/i.test(result.stderr ?? "")) return [null, true];
70
+ return [`label ${OWNER_WORD_LABEL.name}: not created here; run once in the repository: ${LABEL_COMMAND}`, false];
71
+ }
72
+
73
+ function runSubcommand(name, args) {
74
+ const [script, defaults] = SUBCOMMANDS[name];
75
+ const result = spawnSync("python3", [script, ...(args.length > 0 ? args : defaults)], { stdio: "inherit" });
76
+ if (result.error) {
77
+ console.error(`[softure-skills] ${name} needs python3 on PATH: ${result.error.message}`);
78
+ return 1;
79
+ }
80
+ return result.status ?? 1;
81
+ }
82
+
83
+ // True when one of the project's GitHub workflows already runs the doctor.
84
+ function hasDoctorInCi(projectRoot) {
85
+ const dir = path.join(projectRoot, ".github", "workflows");
86
+ if (!fs.existsSync(dir)) return false;
87
+ return fs
88
+ .readdirSync(dir)
89
+ .filter((name) => /\.ya?ml$/.test(name))
90
+ .some((name) => fs.readFileSync(path.join(dir, name), "utf8").includes("softure-skills doctor"));
91
+ }
35
92
 
36
93
  function parseArgs(argv) {
37
94
  const options = { isPostinstall: false, isDryRun: false, target: null, shouldIgnore: true };
@@ -199,6 +256,9 @@ function install(options) {
199
256
  }
200
257
  }
201
258
 
259
+ const [labelAction, hasLabel] = ensureOwnerWordLabel(projectRoot, previous, options);
260
+ if (labelAction) actions.push(labelAction);
261
+
202
262
  if (!options.isDryRun) {
203
263
  fs.mkdirSync(path.join(projectRoot, ".claude"), { recursive: true });
204
264
  const manifest = {
@@ -210,6 +270,7 @@ function install(options) {
210
270
  rules: ruleSections,
211
271
  mode,
212
272
  gitignore: shouldIgnore,
273
+ labels: hasLabel ? [OWNER_WORD_LABEL.name] : [],
213
274
  };
214
275
  // A re-install that changes nothing keeps the old timestamp, so a committed manifest
215
276
  // does not dirty every fresh clone or worktree after `npm ci`.
@@ -222,6 +283,14 @@ function install(options) {
222
283
  const prefix = options.isDryRun ? "[softure-skills] (dry run)" : "[softure-skills]";
223
284
  for (const action of actions) console.log(`${prefix} ${action}`);
224
285
  console.log(`${prefix} ${PACKAGE.name}@${PACKAGE.version} -> ${projectRoot}`);
286
+ if (!hasDoctorInCi(projectRoot)) {
287
+ console.log(`${prefix} CI: add \`${CI_LINE}\` to the project's CI check, documentation-only changes included, once it exits 0 (rollout: doctor --fix, doctor --sweep; WORKFLOW.md §12.4)`);
288
+ }
289
+ }
290
+
291
+ const [subcommand, ...subcommandArgs] = process.argv.slice(2);
292
+ if (subcommand in SUBCOMMANDS) {
293
+ process.exit(runSubcommand(subcommand, subcommandArgs));
225
294
  }
226
295
 
227
296
  try {
@@ -233,4 +302,4 @@ try {
233
302
  process.exit(isPostinstall ? 0 : 1);
234
303
  }
235
304
 
236
- export { replaceManagedBlock, selectRuleSections };
305
+ export { CI_LINE, OWNER_WORD_LABEL, replaceManagedBlock, selectRuleSections };