its-magic 0.1.2-23 → 0.1.2-25

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 CHANGED
@@ -210,6 +210,17 @@ Deterministic ordering behavior (US-0058):
210
210
  remain sorted-canonical by story ID.
211
211
  - Commands fail closed on ambiguous placement anchors using
212
212
  `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`.
213
+ - Commands fail closed on non-monotonic state checkpoint timestamps using
214
+ `STATE_TIMESTAMP_NON_MONOTONIC`.
215
+
216
+ Intake runtime safety behavior (US-0059):
217
+ - `/intake` requires role-specific `po` capability by default and fails fast with
218
+ `SUBAGENT_CAPABILITY_UNAVAILABLE` when unavailable.
219
+ - Silent in-band fallback is disabled by default and only allowed with explicit
220
+ `INTAKE_SUBAGENT_FALLBACK=allow`.
221
+ - Drift detection distinguishes self-write updates from external concurrent
222
+ writers; true conflicting external writes fail safe with
223
+ `INTAKE_CONCURRENT_WRITER_DETECTED`.
213
224
 
214
225
  ## Workflow
215
226
 
@@ -307,6 +318,12 @@ Compaction behavior:
307
318
  `docs/engineering/state-archive/`.
308
319
  - `docs/engineering/decisions.md` stays a compact index with bounded summaries
309
320
  and canonical links to `decisions/DEC-xxxx.md`.
321
+ - Enforced rollover thresholds:
322
+ - `STATE_HOT_MAX_LINES` (default `1200`)
323
+ - `STATE_HOT_MAX_CHECKPOINTS` (default `80`)
324
+ `/refresh-context` must archive oldest checkpoints into deterministic
325
+ `state-pack-*` files when thresholds are exceeded, keeping only bounded recent
326
+ checkpoints in hot surface.
310
327
 
311
328
  `/ask` policy (read-only):
312
329
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "its-magic",
3
- "version": "0.1.2-23",
3
+ "version": "0.1.2-25",
4
4
  "description": "its-magic - AI dev team workflow for Cursor.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -28,6 +28,26 @@ description: "its-magic intake: clarify idea and capture story + acceptance."
28
28
  - Missing acceptance criteria or unclear scope
29
29
  - Decision gate triggered (see escalation rule)
30
30
 
31
+ ## Runtime capability and writer-safety guard (US-0059 / DEC-0041)
32
+
33
+ - `/intake` requires the role-specific `po` subagent capability by default.
34
+ - Before any artifact mutation, run capability preflight:
35
+ - if `po` capability is unavailable, fail fast with
36
+ `SUBAGENT_CAPABILITY_UNAVAILABLE`,
37
+ - emit deterministic remediation guidance (for example: enable role-capable
38
+ runtime or explicitly opt in to fallback policy).
39
+ - Silent in-band fallback is forbidden unless explicit policy opt-in is
40
+ configured (`INTAKE_SUBAGENT_FALLBACK=allow`).
41
+ - For artifact mutations, enforce deterministic single-writer scope:
42
+ - establish writer identity (`writer_id`) and run identity (`intake_run_id`),
43
+ - bind writes to target artifacts (`backlog`, `acceptance`, `vision`,
44
+ `po_to_tl`) for this run.
45
+ - Drift guard semantics:
46
+ - self-write changes from the same `(writer_id, intake_run_id)` are valid and
47
+ must not trigger concurrent-writer blockers,
48
+ - external conflicting mutation during active run must fail safe with
49
+ `INTAKE_CONCURRENT_WRITER_DETECTED` and no partial overwrite.
50
+
31
51
  ## Steps
32
52
  1. Determine intake mode from `.cursor/scratchpad.md`:
33
53
  - guided mode: `INTAKE_GUIDED_MODE=1` (default)
@@ -129,4 +149,7 @@ description: "its-magic intake: clarify idea and capture story + acceptance."
129
149
  - `handoffs/po_to_tl.md` may prepend the latest handoff section only.
130
150
  - If the insertion anchor for any target section is missing/ambiguous, fail with
131
151
  `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS` and avoid partial writes.
152
+ - If intake appends a `docs/engineering/state.md` checkpoint, enforce UTC
153
+ monotonic timestamp guard (`new >= last`); on violation fail with
154
+ `STATE_TIMESTAMP_NON_MONOTONIC` and avoid partial writes.
132
155
 
@@ -27,6 +27,12 @@ description: "its-magic refresh context: compact state and decisions."
27
27
  1. Compact state and decisions into a short context pack.
28
28
  2. Update sprint summary with current status.
29
29
  3. Ensure handoffs and state are consistent.
30
+ 4. Enforce state hot-surface rollover when configured thresholds are exceeded:
31
+ - evaluate `STATE_HOT_MAX_LINES` and `STATE_HOT_MAX_CHECKPOINTS` from
32
+ `.cursor/scratchpad.md`,
33
+ - archive oldest low-frequency checkpoints into deterministic pack files under
34
+ `docs/engineering/state-archive/`,
35
+ - preserve only bounded recent checkpoints in `docs/engineering/state.md`.
30
36
 
31
37
  ## Deterministic artifact ordering contract (US-0058 / DEC-0040)
32
38
 
@@ -38,4 +44,7 @@ description: "its-magic refresh context: compact state and decisions."
38
44
  context section; historical details remain intact.
39
45
  - Missing/ambiguous anchors fail with `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`
40
46
  (no partial write).
47
+ - Archive write or rollover boundary ambiguity fails with
48
+ `STATE_ARCHIVE_WRITE_FAILED` or `STATE_ARCHIVE_BOUNDARY_AMBIGUOUS`
49
+ (no partial write).
41
50
 
@@ -96,17 +96,26 @@ AUTO_PUSH_BRANCH_ALLOWLIST=
96
96
  # Knowledge curation / intake
97
97
  # - EARLY_RESEARCH: 0|1 (PO/TL search web during intake/architecture)
98
98
  # - INTAKE_GUIDED_MODE: 0|1 (guided intake follow-up/options/research behavior)
99
+ # - INTAKE_SUBAGENT_FALLBACK: deny|allow (deny by default; when deny, missing
100
+ # role-specific intake subagent capability fails fast)
99
101
  # - ID_NAMESPACE_BOOTSTRAP: 0|1 (optional fresh-project ID bootstrap mode; when 1, allow first IDs to start at 0001 only if deterministic freshness checks pass)
100
102
  # - TOKEN_PROFILE: lean|balanced|full (tiered token-cost profile defaults)
101
103
  # - lean: lowest-token default profile; reduce non-critical automation/research intensity
102
104
  # - balanced: default profile; preserves current behavior with moderate overhead
103
105
  # - full: highest-context profile; maximize context breadth/autonomy
106
+ # - STATE_HOT_MAX_LINES: integer >= 200 (hot-surface soft cap trigger for
107
+ # archival rollover checks)
108
+ # - STATE_HOT_MAX_CHECKPOINTS: integer >= 10 (max recent checkpoints to retain
109
+ # in `state.md` after rollover)
104
110
  # - Manual-override precedence: explicit flag values in this file remain authoritative
105
111
  # for that flag and override profile defaults.
106
112
  EARLY_RESEARCH=1
107
113
  INTAKE_GUIDED_MODE=1
114
+ INTAKE_SUBAGENT_FALLBACK=deny
108
115
  ID_NAMESPACE_BOOTSTRAP=0
109
116
  TOKEN_PROFILE=balanced
117
+ STATE_HOT_MAX_LINES=1200
118
+ STATE_HOT_MAX_CHECKPOINTS=80
110
119
  #
111
120
  # Publish targets
112
121
  # - RELEASE_PUBLISH_MODE: disabled|confirm|auto
@@ -41,11 +41,11 @@ MAGIC_BENCH_SESSION=
41
41
  # - AUTO_EXECUTE_ON_BLOCK: stop|skip (behavior when a planned item blocks)
42
42
  # - AUTO_EXECUTE_SELECTION: planned_then_priority
43
43
  # - AUTO_TEAM_SCOPE_ENFORCE: 0|1 (when TEAM_MODE=1, enforce TEAM_MEMBER + ACTIVE_TASK_IDS)
44
- AUTO_FLOW_MODE=manual
44
+ AUTO_FLOW_MODE=auto_until_decision
45
45
  PHASE_MODE=interactive
46
46
  PERMISSION_MODE=interactive
47
47
  AUTO_INSTALL_DEPS=0
48
- AUTO_RELEASE_NOTES=0
48
+ AUTO_RELEASE_NOTES=1
49
49
  AUTO_BACKLOG_DRAIN=0
50
50
  AUTO_BACKLOG_MAX_STORIES=1
51
51
  AUTO_BACKLOG_ON_BLOCK=stop
@@ -56,6 +56,14 @@ AUTO_EXECUTE_ON_BLOCK=stop
56
56
  AUTO_EXECUTE_SELECTION=planned_then_priority
57
57
  AUTO_TEAM_SCOPE_ENFORCE=1
58
58
  #
59
+ # Team mode
60
+ # - TEAM_MODE: 0|1 (enable task/member scoped team workflow)
61
+ # - TEAM_MEMBER: short id for current developer
62
+ # - ACTIVE_TASK_IDS: comma-separated task ids (for example T-12,T-13)
63
+ TEAM_MODE=0
64
+ TEAM_MEMBER=
65
+ ACTIVE_TASK_IDS=
66
+ #
59
67
  # Sprint planning
60
68
  # - SPRINT_MAX_TASKS: integer >= 1 (max atomic tasks per sprint, default 12)
61
69
  # - SPRINT_AUTO_SPLIT: 0|1 (propose splitting when over threshold)
@@ -86,22 +94,31 @@ SYNC_CUSTOM_PHASES=
86
94
  ALLOW_AUTO_PUSH=0
87
95
  AUTO_PUSH_BRANCH_ALLOWLIST=
88
96
  #
89
- # Knowledge curation
97
+ # Knowledge curation / intake
90
98
  # - EARLY_RESEARCH: 0|1 (PO/TL search web during intake/architecture)
91
99
  # - INTAKE_GUIDED_MODE: 0|1 (guided intake follow-up/options/research behavior)
100
+ # - INTAKE_SUBAGENT_FALLBACK: deny|allow (deny by default; when deny, missing
101
+ # role-specific intake subagent capability fails fast)
92
102
  # - ID_NAMESPACE_BOOTSTRAP: 0|1 (optional fresh-project ID bootstrap mode; when 1, allow first IDs to start at 0001 only if deterministic freshness checks pass)
93
103
  # - TOKEN_PROFILE: lean|balanced|full (tiered token-cost profile defaults)
94
104
  # - lean: lowest-token default profile; reduce non-critical automation/research intensity
95
105
  # - balanced: default profile; preserves current behavior with moderate overhead
96
106
  # - full: highest-context profile; maximize context breadth/autonomy
107
+ # - STATE_HOT_MAX_LINES: integer >= 200 (hot-surface soft cap trigger for
108
+ # archival rollover checks)
109
+ # - STATE_HOT_MAX_CHECKPOINTS: integer >= 10 (max recent checkpoints to retain
110
+ # in `state.md` after rollover)
97
111
  # - Manual-override precedence: explicit flag values in this file remain authoritative
98
112
  # for that flag and override profile defaults.
99
113
  EARLY_RESEARCH=1
100
114
  INTAKE_GUIDED_MODE=1
115
+ INTAKE_SUBAGENT_FALLBACK=deny
101
116
  ID_NAMESPACE_BOOTSTRAP=0
102
117
  TOKEN_PROFILE=balanced
118
+ STATE_HOT_MAX_LINES=1200
119
+ STATE_HOT_MAX_CHECKPOINTS=80
103
120
 
104
- # Publish targets (US-0054)
121
+ # Publish targets
105
122
  # - RELEASE_PUBLISH_MODE: disabled|confirm|auto
106
123
  # - disabled: skip post-release publish target execution
107
124
  # - confirm: require explicit operator confirmation before publish (default)
@@ -121,7 +138,7 @@ RELEASE_TARGETS_DEFAULT=
121
138
  SECURITY_REVIEW=0
122
139
  COMPLIANCE_PROFILES=GDPR
123
140
 
124
- # Cross-repo compatibility observability
141
+ # Compatibility observability
125
142
  # - CROSS_REPO_OBSERVABILITY: 0|1 (enable compatibility visibility and checks)
126
143
  # - COMPATIBILITY_GATE_ON_CRITICAL: 0|1 (when enabled, critical unresolved
127
144
  # compatibility findings trigger decision gate before release)
@@ -131,19 +148,15 @@ CROSS_REPO_OBSERVABILITY=0
131
148
  COMPATIBILITY_GATE_ON_CRITICAL=1
132
149
  COMPATIBILITY_SOURCES=
133
150
 
134
- # Component-scoped execution mode
151
+ # Component scope
135
152
  # - COMPONENT_SCOPE_MODE: 0|1 (enable scoped planning/execution guardrails)
136
153
  # - TARGET_COMPONENTS: comma-separated component IDs intended in scope
137
154
  COMPONENT_SCOPE_MODE=0
138
155
  TARGET_COMPONENTS=
139
156
 
140
- # Optional spec-pack documentation (US-0031)
157
+ # Optional docs packs
141
158
  # - SPEC_PACK_MODE: 0|1 (enable Design Concept, CRS, Technical Spec generation/validation; default 0)
142
159
  # When 0, intake/architecture/release add no required spec-pack steps.
143
160
  SPEC_PACK_MODE=0
144
-
145
- # Optional user-guide documentation (US-0032)
146
- # - USER_GUIDE_MODE: 0|1 (enable per-feature user guides at docs/user-guides/US-xxxx.md; default 0)
147
- # When 0, intake/architecture/sprint-plan/execute/qa/release add no required user-guide steps or blocking checks.
148
161
  USER_GUIDE_MODE=0
149
162
 
@@ -210,6 +210,17 @@ Deterministic ordering behavior (US-0058):
210
210
  remain sorted-canonical by story ID.
211
211
  - Commands fail closed on ambiguous placement anchors using
212
212
  `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`.
213
+ - Commands fail closed on non-monotonic state checkpoint timestamps using
214
+ `STATE_TIMESTAMP_NON_MONOTONIC`.
215
+
216
+ Intake runtime safety behavior (US-0059):
217
+ - `/intake` requires role-specific `po` capability by default and fails fast with
218
+ `SUBAGENT_CAPABILITY_UNAVAILABLE` when unavailable.
219
+ - Silent in-band fallback is disabled by default and only allowed with explicit
220
+ `INTAKE_SUBAGENT_FALLBACK=allow`.
221
+ - Drift detection distinguishes self-write updates from external concurrent
222
+ writers; true conflicting external writes fail safe with
223
+ `INTAKE_CONCURRENT_WRITER_DETECTED`.
213
224
 
214
225
  ## Workflow
215
226
 
@@ -307,6 +318,12 @@ Compaction behavior:
307
318
  `docs/engineering/state-archive/`.
308
319
  - `docs/engineering/decisions.md` stays a compact index with bounded summaries
309
320
  and canonical links to `decisions/DEC-xxxx.md`.
321
+ - Enforced rollover thresholds:
322
+ - `STATE_HOT_MAX_LINES` (default `1200`)
323
+ - `STATE_HOT_MAX_CHECKPOINTS` (default `80`)
324
+ `/refresh-context` must archive oldest checkpoints into deterministic
325
+ `state-pack-*` files when thresholds are exceeded, keeping only bounded recent
326
+ checkpoints in hot surface.
310
327
 
311
328
  `/ask` policy (read-only):
312
329
 
@@ -8,7 +8,7 @@ anchors are missing or ambiguous.
8
8
 
9
9
  | Artifact | Policy | Deterministic rule |
10
10
  |---|---|---|
11
- | `docs/engineering/state.md` | `append-bottom` | Add new checkpoints only at end of file, in chronological order. |
11
+ | `docs/engineering/state.md` | `append-bottom` | Add new checkpoints only at end of file, in chronological order; enforce hot-surface rollover when configured thresholds are exceeded. |
12
12
  | `docs/product/backlog.md` | `sorted-canonical` | Keep stories sorted by numeric `US-xxxx` ID; mutate only target story block. |
13
13
  | `docs/product/acceptance.md` | `sorted-canonical` | Keep `US-xxxx` rows ordered by numeric ID aligned to backlog order. |
14
14
  | `handoffs/release_queue.md` | `append-bottom` | Append only one row per new sprint in release order. |
@@ -20,6 +20,10 @@ anchors are missing or ambiguous.
20
20
  - Re-running a command without semantic changes must not reorder rows/blocks.
21
21
  - No oscillation between top and bottom insertion paths.
22
22
  - No broad rewrites of unrelated story/sprint entries.
23
+ - For `docs/engineering/state.md`, each newly appended checkpoint timestamp must
24
+ be monotonic (`new_timestamp >= last_checkpoint_timestamp`) in UTC.
25
+ - For rollover reruns, archive partition boundaries and pack naming must be
26
+ deterministic (no duplicate or oscillating pack generation).
23
27
 
24
28
  ## Fail-safe behavior
25
29
 
@@ -27,3 +31,16 @@ If required placement anchors are missing or ambiguous:
27
31
  - stop with reason code `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`,
28
32
  - emit remediation guidance with expected anchor and file path,
29
33
  - perform no partial mutation.
34
+
35
+ If a new `state.md` checkpoint timestamp is older than the current last
36
+ checkpoint timestamp:
37
+ - stop with reason code `STATE_TIMESTAMP_NON_MONOTONIC`,
38
+ - emit remediation guidance with the expected minimum timestamp,
39
+ - perform no partial mutation.
40
+
41
+ If configured state hot-surface rollover cannot determine a safe archive
42
+ boundary or cannot persist archive pack writes:
43
+ - stop with reason code `STATE_ARCHIVE_BOUNDARY_AMBIGUOUS` or
44
+ `STATE_ARCHIVE_WRITE_FAILED`,
45
+ - emit remediation guidance with threshold/boundary details and target path,
46
+ - perform no partial mutation.
@@ -131,6 +131,17 @@ Context compaction policy:
131
131
  append-only/non-destructive.
132
132
  - `docs/engineering/decisions.md` is a compact index with bounded summaries and
133
133
  canonical links to full records in `decisions/DEC-xxxx.md`.
134
+ - Enforced rollover thresholds:
135
+ - `STATE_HOT_MAX_LINES` (default `1200`)
136
+ - `STATE_HOT_MAX_CHECKPOINTS` (default `80`)
137
+ When either threshold is exceeded during `/refresh-context`, older checkpoints
138
+ are archived into deterministic `state-pack-*` files and only bounded recent
139
+ checkpoints remain in hot surface.
140
+
141
+ Rollover fail-safe reason codes:
142
+
143
+ - `STATE_ARCHIVE_BOUNDARY_AMBIGUOUS`
144
+ - `STATE_ARCHIVE_WRITE_FAILED`
134
145
 
135
146
  `/ask` retrieval policy:
136
147
 
@@ -834,6 +845,8 @@ Required write discipline:
834
845
  Fail-safe contract:
835
846
  - Missing/ambiguous placement anchors fail closed with
836
847
  `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`.
848
+ - Non-monotonic `state.md` checkpoint timestamps fail closed with
849
+ `STATE_TIMESTAMP_NON_MONOTONIC`.
837
850
  - No partial mutation on fail-safe path.
838
851
  - Re-run without semantic changes must be ordering-idempotent.
839
852
 
@@ -842,6 +855,28 @@ Execution guidance:
842
855
  - Packaging smoke: run npm local tests in `packaging/npm/`.
843
856
  - CI evidence: inspect `npm-test`, `brew-test`, and `choco-test` job logs.
844
857
 
858
+ ## Intake runtime capability and single-writer safety (US-0059 / DEC-0041)
859
+
860
+ `/intake` enforces deterministic runtime preflight and drift safety before
861
+ artifact mutation.
862
+
863
+ Capability preflight:
864
+ - Required role capability: `po` subagent.
865
+ - Default policy: fail fast when unavailable with
866
+ `SUBAGENT_CAPABILITY_UNAVAILABLE`.
867
+ - Fallback policy is explicit only:
868
+ - `INTAKE_SUBAGENT_FALLBACK=deny` (default): no silent fallback.
869
+ - `INTAKE_SUBAGENT_FALLBACK=allow`: explicit operator opt-in for fallback path.
870
+
871
+ Single-writer drift safety:
872
+ - Intake run binds a deterministic writer/run identity (`writer_id`,
873
+ `intake_run_id`) to target artifacts.
874
+ - Self-write updates for the active writer/run are valid and must not trigger
875
+ concurrent drift blockers.
876
+ - External concurrent conflicting writes fail safe with
877
+ `INTAKE_CONCURRENT_WRITER_DETECTED`.
878
+ - Fail-safe path performs no partial overwrite.
879
+
845
880
  ## Project run steps
846
881
 
847
882
  ### Prerequisites