sia-package 0.2.0__tar.gz

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.
@@ -0,0 +1,141 @@
1
+ # SIA (Self Improving Agents)
2
+
3
+ ## Runtime Re-entry
4
+
5
+ When the `sia` CLI is installed, run `sia next --json` before SIA work and
6
+ after a new session or context compaction. The persisted `.sia/state.json`
7
+ stage is authoritative; this file supplies the detailed policy. Select
8
+ `advisory`, `planning`, or `orchestrator` mode during `sia init`. SIA is
9
+ explicitly invoked and must coexist with other skills/plugins according to
10
+ `HOST-INTEGRATION.md`; do not install an always-on hook.
11
+
12
+ ## What This Is
13
+
14
+ SIA is a portable, host-agnostic instruction package. It turns any coding
15
+ assistant that can read files, load skill/instruction files, and spawn
16
+ scoped subagents into a self-improving project collaborator — one that
17
+ authors its own project-specific process artifacts instead of declaring
18
+ "done" prematurely.
19
+
20
+ **Read this file in full before taking any other action in this project.**
21
+
22
+ SIA is a *generator*, not a library of pre-built domain packs. Every
23
+ project gets its own fresh `AGENT.md`, spec, plan, **project-specific
24
+ skill files**, and subagent task briefs, authored from that project's
25
+ evidence — never copied from another project. The one exception is
26
+ `guides/security-gate.md`, a fixed, reused checklist loaded only for
27
+ software projects.
28
+
29
+ **If you're setting SIA up in a project for the first time** (this file
30
+ exists but nothing generated by it does yet), read `INSTALL.md` first —
31
+ it covers gitignoring this vendored `sia/` folder correctly (keeping the
32
+ *generated* artifacts committed) and, for Claude Code, an optional
33
+ discovery shim so this file gets found without being told to.
34
+
35
+ ## Authority Order
36
+
37
+ When two sources of instruction conflict, resolve in this order, highest
38
+ first:
39
+
40
+ 1. **User instructions** — whatever the user says in the current
41
+ conversation, directly.
42
+ 2. **This project's own `AGENT.md`** — the generated file, including its
43
+ Project-Specific Rules and Accumulated Feedback Rules.
44
+ 3. **The approved spec/plan** for the current piece of work.
45
+ 4. **SIA's static guides** (this file and everything under `guides/`).
46
+ 5. **A subagent's own task brief** — the narrowest, most disposable
47
+ layer; a brief is written *from* the plan and guides above it, and
48
+ never overrides them.
49
+
50
+ A guide describes the default; a project's own `AGENT.md` rule exists
51
+ specifically to override a default that didn't fit that project (that is
52
+ the entire point of the Accumulated Feedback Rules mechanism — see
53
+ `capture-interface.md`). If a static guide and a project's own rule ever
54
+ conflict, the project's rule wins, and the conflict itself is worth a
55
+ Medium-severity note back to the user rather than silent resolution
56
+ either way.
57
+
58
+ ## Guides
59
+
60
+ Load these as needed, per the pipeline stage you're in:
61
+
62
+ - `guides/questioning-and-approval.md` — batching clarifying questions,
63
+ severity-tagged approval gates. Applies to every stage.
64
+ - `guides/writing-agent-md.md` — how to author *this project's own*
65
+ `AGENT.md`/`AGENTS.md`.
66
+ - `guides/writing-spec.md` — how to author *this project's own* spec.
67
+ - `guides/writing-plan.md` — how to break a spec into an implementation
68
+ plan.
69
+ - `guides/writing-project-skills.md` — how to synthesize the project's
70
+ own host-discoverable skills from its goals, contract, and plan.
71
+ - `guides/subagent-task-brief.md` — task brief / report / progress-log
72
+ formats for subagent-driven execution.
73
+ - `guides/security-gate.md` — fixed threat-class checklist. Load only
74
+ when this project is a software project (greenfield or brownfield).
75
+
76
+ See also `capture-interface.md` for the feedback-capture schema and the
77
+ self-healing loop-engineering mechanism, and `VALIDATION.md` for how this
78
+ package is dogfooded before a version is called stable.
79
+
80
+ ## Launch Screen
81
+
82
+ If your host can run a shell command, run `python3 sia/banner.py` once at
83
+ the start of a session in this project and show its output before
84
+ proceeding — it prints the SIA mark and a one-line status of which gates
85
+ are active (loop engineering, security gate, human approval gates). If your
86
+ host cannot execute shell commands, read and display `sia/BANNER.txt`
87
+ instead — the same banner, pre-rendered as plain text, with the directory
88
+ line left as a `<current project directory>` placeholder for you to fill in
89
+ or drop. Either way this is cosmetic — skip it entirely rather than block
90
+ on it if neither option is available.
91
+
92
+ ## Pipeline
93
+
94
+ 1. **Bootstrap** — you're doing this now, by reading this file. Show the
95
+ launch screen above first, if your host supports it.
96
+ 2. **Intake** — look for an existing requirements artifact (`.md`,
97
+ `.pdf`, `.docx`, or similar) anywhere reasonable in the project. Form
98
+ a best guess of project type from what's present (existing code and
99
+ its stack → greenfield/brownfield software; `.pptx`/`.docx`/proposal
100
+ language → document/deck prep; design assets/mockup language →
101
+ design work). State the guess and your evidence, then ask the user
102
+ to confirm or correct it, batched into one question per
103
+ `guides/questioning-and-approval.md`. If no artifact exists,
104
+ interview the user instead, same batching rule.
105
+ 3. **Spec authoring** — using `guides/writing-spec.md`, write this
106
+ project's own spec into its own `docs/specs/`.
107
+ 4. **AGENT.md authoring** — using `guides/writing-agent-md.md`, write
108
+ this project's own `AGENT.md`/`AGENTS.md`.
109
+ 5. **Project-skill synthesis** — using
110
+ `guides/writing-project-skills.md`, generate the host-discoverable,
111
+ project-specific skills required for this project. Record their
112
+ provenance in a skill manifest. The user never has to design this
113
+ skill pack manually.
114
+ 6. **Plan authoring** — using `guides/writing-plan.md`, break the spec
115
+ into an implementation plan, saved into this project's own
116
+ `docs/plans/`.
117
+ 7. **Execution** — using `guides/subagent-task-brief.md`, materialize a
118
+ brief, host-dispatch record, subagent report, and reviewer verdict for
119
+ every implementation task. If the host can spawn subagents, the
120
+ controller **must not implement a task-owned file itself**: it briefs,
121
+ dispatches, reviews, integrates, and escalates. If the host cannot
122
+ spawn subagents, stop and tell the user before implementation rather
123
+ than silently substituting single-agent work. After every task in the
124
+ plan is individually reviewed and complete, run one **Integration
125
+ phase** before declaring the plan done: run the project's full
126
+ test/build suite (not just each task's own check), verify the named
127
+ Interfaces between tasks actually match up in the combined code (not
128
+ just each task's own diff in isolation), and review the whole plan's
129
+ combined diff as one unit.
130
+ 8. **Feedback loop** — capture corrections, review findings, and (for
131
+ software projects) security-gate findings via
132
+ `capture(signal_type, context, severity, error_class)` (see `capture-interface.md`),
133
+ fold them into this project's own `AGENT.md` as standing rules, and
134
+ run the pre-flight self-check from `capture-interface.md` before
135
+ presenting the next piece of work.
136
+
137
+ Approval gates (`guides/questioning-and-approval.md`) wrap every stage.
138
+ Never assume on a non-trivial decision; never delete, replace, or
139
+ restructure anything without explicit approval; never declare a stage
140
+ "done" until its acceptance criteria are met and the user has approved
141
+ any high-impact work in it.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GunjanGrunge
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.2
2
+ Name: sia-package
3
+ Version: 0.2.0
4
+ Summary: Host-neutral, persistent orchestration for Self-Improving Agents
5
+ Author: GunjanGrunge
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/GunjanGrunge/SIA_package
8
+ Project-URL: Repository, https://github.com/GunjanGrunge/SIA_package
9
+ Project-URL: Issues, https://github.com/GunjanGrunge/SIA_package/issues
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+
14
+ <p align="center">
15
+ <img src="./assets/sia-banner.png" alt="SIA: Self-Improving Agents" width="100%" />
16
+ </p>
17
+
18
+ <p align="center">
19
+ <img src="https://img.shields.io/badge/version-0.2.0-00F2FE.svg?style=flat-square" alt="Version 0.2.0" />
20
+ <img src="https://img.shields.io/badge/status-active-success.svg?style=flat-square" alt="Status: Active" />
21
+ <img src="https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat-square" alt="License: MIT" />
22
+ <img src="https://img.shields.io/badge/host--agnostic-yes-7B2CBF.svg?style=flat-square" alt="Host-agnostic" />
23
+ </p>
24
+
25
+ <p align="center"><b>Persistent, host-neutral orchestration for self-improving coding agents.</b></p>
26
+
27
+ SIA combines detailed workflow guidance with an installable Python CLI. The CLI
28
+ keeps the current stage, subagent evidence, feedback events, standing rules,
29
+ and convergence data under `.sia/`, so SIA survives fresh chats and context
30
+ compaction instead of appearing only at the beginning of a session.
31
+
32
+ SIA supports three explicit modes: `advisory`, `planning`, and `orchestrator`.
33
+ Its host adapters are manual launchers, so BMAD, Superpowers, and other plugins
34
+ remain usable in parallel.
35
+
36
+ ## Install
37
+
38
+ ```powershell
39
+ python -m pip install sia-package
40
+ sia init --mode orchestrator
41
+ sia adapter install --host kiro
42
+ sia next --json
43
+ ```
44
+
45
+ Replace `kiro` with `claude`, `codex`, or `antigravity`. You can also vendor
46
+ this repository as `sia/`; see [`INSTALL.md`](./INSTALL.md). No provider API
47
+ key or cloud service is required by SIA itself.
48
+
49
+ ## Core commands
50
+
51
+ ```text
52
+ sia init --mode advisory|planning|orchestrator
53
+ sia next --json durable host re-entry packet
54
+ sia advance --evidence <path> evidence-gated stage transition
55
+ sia task prepare ... establish exclusive file ownership
56
+ sia task dispatch ... persist native host agent/run identity
57
+ sia task finish ... attach report + independently identified review
58
+ sia integration --evidence ... attach combined validation/review
59
+ sia record ... / sia capture ... persist PASS/DEVIATION outcomes
60
+ sia rule add ... / sia preflight ... / sia convergence
61
+ sia adapter install --host ... install an explicit, namespaced launcher
62
+ sia owner --stage plan --to bmad assign stage ownership in bridge mode
63
+ sia doctor diagnose project integration
64
+ ```
65
+
66
+ The CLI does not fake universal agent spawning. Claude Code, Codex, Kiro, and
67
+ Antigravity create agents through their own native harnesses; SIA checks the
68
+ ordering, ownership, and completeness of the common brief/dispatch/review
69
+ record. Native IDs are caller-attested because vendor harnesses do not expose
70
+ one shared authentication API. See
71
+ [`HOST-INTEGRATION.md`](./HOST-INTEGRATION.md).
72
+
73
+ ## Architecture
74
+
75
+ <p align="center">
76
+ <img src="./assets/architecture-flowchart.png" alt="SIA pipeline diagram" width="100%" />
77
+ </p>
78
+
79
+ ```text
80
+ host /sia command
81
+
82
+
83
+ sia next --json ──► .sia/config.json + .sia/state.json
84
+
85
+ ├── guidance: AGENT.md / installed `sia guide`
86
+ ├── native agents: host-owned spawning and parallelism
87
+ ├── evidence: .sia/runs/<run-id>/
88
+ └── learning: events.jsonl + rules.json + preflight/convergence
89
+ ```
90
+
91
+ ## Repository layout
92
+
93
+ ```text
94
+ src/sia/ # installable CLI and orchestration runtime
95
+ AGENT.md # detailed vendored workflow policy
96
+ HOST-INTEGRATION.md # modes, adapters, and coexistence contract
97
+ guides/ # spec/plan/skill/task/security guidance
98
+ integrations/ # source shims for supported hosts
99
+ capture-interface.md # feedback and convergence semantics
100
+ tests/validate_sia.py # package contract validator
101
+ ```
102
+
103
+ ## Coexistence
104
+
105
+ The default `bridge` policy detects common framework folders, records them in
106
+ `.sia/config.json`, never replaces root `AGENT.md`/`AGENTS.md`, and refuses to
107
+ overwrite adapter files. Choose `advisory` when another framework owns the
108
+ whole development workflow, `planning` when it owns execution, or
109
+ `orchestrator` when SIA should own native-agent dispatch and integration.
110
+
111
+ ## Validation
112
+
113
+ Run `python tests/validate_sia.py`, `python -m compileall src`, and a CLI smoke
114
+ run in a temporary project. `VALIDATION.md` contains host-level dogfood
115
+ scenarios that cannot be proven by structural tests alone.
116
+
117
+ ## License
118
+
119
+ MIT.
@@ -0,0 +1,106 @@
1
+ <p align="center">
2
+ <img src="./assets/sia-banner.png" alt="SIA: Self-Improving Agents" width="100%" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <img src="https://img.shields.io/badge/version-0.2.0-00F2FE.svg?style=flat-square" alt="Version 0.2.0" />
7
+ <img src="https://img.shields.io/badge/status-active-success.svg?style=flat-square" alt="Status: Active" />
8
+ <img src="https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat-square" alt="License: MIT" />
9
+ <img src="https://img.shields.io/badge/host--agnostic-yes-7B2CBF.svg?style=flat-square" alt="Host-agnostic" />
10
+ </p>
11
+
12
+ <p align="center"><b>Persistent, host-neutral orchestration for self-improving coding agents.</b></p>
13
+
14
+ SIA combines detailed workflow guidance with an installable Python CLI. The CLI
15
+ keeps the current stage, subagent evidence, feedback events, standing rules,
16
+ and convergence data under `.sia/`, so SIA survives fresh chats and context
17
+ compaction instead of appearing only at the beginning of a session.
18
+
19
+ SIA supports three explicit modes: `advisory`, `planning`, and `orchestrator`.
20
+ Its host adapters are manual launchers, so BMAD, Superpowers, and other plugins
21
+ remain usable in parallel.
22
+
23
+ ## Install
24
+
25
+ ```powershell
26
+ python -m pip install sia-package
27
+ sia init --mode orchestrator
28
+ sia adapter install --host kiro
29
+ sia next --json
30
+ ```
31
+
32
+ Replace `kiro` with `claude`, `codex`, or `antigravity`. You can also vendor
33
+ this repository as `sia/`; see [`INSTALL.md`](./INSTALL.md). No provider API
34
+ key or cloud service is required by SIA itself.
35
+
36
+ ## Core commands
37
+
38
+ ```text
39
+ sia init --mode advisory|planning|orchestrator
40
+ sia next --json durable host re-entry packet
41
+ sia advance --evidence <path> evidence-gated stage transition
42
+ sia task prepare ... establish exclusive file ownership
43
+ sia task dispatch ... persist native host agent/run identity
44
+ sia task finish ... attach report + independently identified review
45
+ sia integration --evidence ... attach combined validation/review
46
+ sia record ... / sia capture ... persist PASS/DEVIATION outcomes
47
+ sia rule add ... / sia preflight ... / sia convergence
48
+ sia adapter install --host ... install an explicit, namespaced launcher
49
+ sia owner --stage plan --to bmad assign stage ownership in bridge mode
50
+ sia doctor diagnose project integration
51
+ ```
52
+
53
+ The CLI does not fake universal agent spawning. Claude Code, Codex, Kiro, and
54
+ Antigravity create agents through their own native harnesses; SIA checks the
55
+ ordering, ownership, and completeness of the common brief/dispatch/review
56
+ record. Native IDs are caller-attested because vendor harnesses do not expose
57
+ one shared authentication API. See
58
+ [`HOST-INTEGRATION.md`](./HOST-INTEGRATION.md).
59
+
60
+ ## Architecture
61
+
62
+ <p align="center">
63
+ <img src="./assets/architecture-flowchart.png" alt="SIA pipeline diagram" width="100%" />
64
+ </p>
65
+
66
+ ```text
67
+ host /sia command
68
+
69
+
70
+ sia next --json ──► .sia/config.json + .sia/state.json
71
+
72
+ ├── guidance: AGENT.md / installed `sia guide`
73
+ ├── native agents: host-owned spawning and parallelism
74
+ ├── evidence: .sia/runs/<run-id>/
75
+ └── learning: events.jsonl + rules.json + preflight/convergence
76
+ ```
77
+
78
+ ## Repository layout
79
+
80
+ ```text
81
+ src/sia/ # installable CLI and orchestration runtime
82
+ AGENT.md # detailed vendored workflow policy
83
+ HOST-INTEGRATION.md # modes, adapters, and coexistence contract
84
+ guides/ # spec/plan/skill/task/security guidance
85
+ integrations/ # source shims for supported hosts
86
+ capture-interface.md # feedback and convergence semantics
87
+ tests/validate_sia.py # package contract validator
88
+ ```
89
+
90
+ ## Coexistence
91
+
92
+ The default `bridge` policy detects common framework folders, records them in
93
+ `.sia/config.json`, never replaces root `AGENT.md`/`AGENTS.md`, and refuses to
94
+ overwrite adapter files. Choose `advisory` when another framework owns the
95
+ whole development workflow, `planning` when it owns execution, or
96
+ `orchestrator` when SIA should own native-agent dispatch and integration.
97
+
98
+ ## Validation
99
+
100
+ Run `python tests/validate_sia.py`, `python -m compileall src`, and a CLI smoke
101
+ run in a temporary project. `VALIDATION.md` contains host-level dogfood
102
+ scenarios that cannot be proven by structural tests alone.
103
+
104
+ ## License
105
+
106
+ MIT.
@@ -0,0 +1,166 @@
1
+ # Feedback Capture Interface & Loop Engineering
2
+
3
+ This is SIA's self-improving layer: how a project accumulates fewer
4
+ mistakes over its own lifetime, not just a longer history of them.
5
+
6
+ ## The Interface
7
+
8
+ ```
9
+ capture(signal_type, context, severity, error_class)
10
+ ```
11
+
12
+ - `signal_type` — free-text category, project-defined (e.g.
13
+ `security-finding`, `user-correction`, `review-finding`,
14
+ `spec-ambiguity`).
15
+ - `context` — what happened and where: a file/section reference, and
16
+ the user's correction verbatim where one exists.
17
+ - `severity` — `low` / `medium` / `high`, the same scale as
18
+ `guides/questioning-and-approval.md`'s severity table.
19
+ - `error_class` — a short, reusable label for *what kind* of mistake this
20
+ is, distinct from `signal_type` (which is about where the signal came
21
+ from). Reuse an existing class if this DEVIATION is the same kind of
22
+ mistake as one already captured; only mint a new class when it
23
+ genuinely isn't. Example classes: `unsafe-edit-target` (proposing to
24
+ change something that shouldn't be hand-edited, e.g. a generated
25
+ artifact), `missing-approval` (proceeding on a High-severity action
26
+ without confirmation), `interface-assumption` (assuming a type/shape
27
+ that turned out wrong), `unverified-claim` (asserting something works
28
+ without the evidence to back it — see Rule Provenance below for why
29
+ this class matters especially). This is what makes recurrence
30
+ trackable *by kind of mistake*, not just as one undifferentiated rate
31
+ (see Convergence Signal).
32
+
33
+ Every call appends a structured entry to that project's session log.
34
+ When the signal represents a standing rule ("don't delete components
35
+ without asking", "always sanitize this auth flow"), propose adding it
36
+ to that project's own `AGENT.md` under Accumulated Feedback Rules (see
37
+ `guides/writing-agent-md.md`), subject to the normal approval gate for
38
+ anything above low severity — recorded with the full provenance fields
39
+ below, not just the rule text.
40
+
41
+ ## Rule Provenance
42
+
43
+ Every Accumulated Feedback Rule carries, not just the rule text itself:
44
+
45
+ - **Source event** — the specific session/experiment/task that produced
46
+ it (a session-log reference, not "learned over time").
47
+ - **Evidence** — the actual `context` from the `capture()` call that
48
+ produced it, quoted, not paraphrased.
49
+ - **Severity** — carried over from the originating `capture()` call.
50
+ - **Error class** — carried over from the originating `capture()` call.
51
+ - **Scope** — exactly what this rule governs (a file, a pattern, a
52
+ category of action) — narrow enough that a future pre-flight check can
53
+ actually tell whether a proposed change falls under it.
54
+ - **Date introduced.**
55
+ - **Status** — `active` or `retired` (see Rule Hygiene's expiry
56
+ mechanism below). A retired rule stays in the file with its status
57
+ changed, not deleted — deleting it would erase the provenance record
58
+ of why it existed at all.
59
+
60
+ A rule missing any of these fields is incomplete — propose the complete
61
+ record, not just the imperative sentence, when adding one.
62
+
63
+ ## PASS / DEVIATION
64
+
65
+ Classify every stage outcome as one of:
66
+
67
+ - **PASS** — the user approved without correction, verification/tests
68
+ passed, review found nothing.
69
+ - **DEVIATION** — a user correction, a rejected proposal, a
70
+ security-gate finding, a failed verification, a review finding.
71
+
72
+ Only DEVIATIONs are captured via the interface above. PASSes aren't
73
+ logged for their own sake, but they feed the Convergence Signal below.
74
+
75
+ ### Process And Framework Deviations
76
+
77
+ Capture process failures as seriously as code failures. Examples include
78
+ skipping project-skill synthesis, a controller implementing a task that
79
+ should have been delegated, a missing dispatch record, or claiming token
80
+ budget compliance without host telemetry. Use a specific error class such
81
+ as `framework-default-override`, record the evidence, and turn the
82
+ correction into an active project rule before the next task.
83
+
84
+ ## Pre-Flight Self-Check
85
+
86
+ Logging a DEVIATION is necessary but not sufficient — this step is what
87
+ actually makes the loop self-healing rather than a history nobody
88
+ re-reads. Before presenting the *next* proposal, spec section, plan, or
89
+ generated change:
90
+
91
+ 1. Read that project's current `AGENT.md` Accumulated Feedback Rules
92
+ section in full.
93
+ 2. Check the work about to be presented against every rule there.
94
+ 3. Silently self-correct anything that would violate a low-severity
95
+ rule before showing the user anything.
96
+ 4. For anything that would violate a medium/high-severity rule, state
97
+ the conflict explicitly — e.g. "this would touch the auth flow
98
+ flagged after the correction on 2026-09-10; proceeding needs your
99
+ approval per that rule" — and route it through the approval gate.
100
+
101
+ ## Convergence Signal
102
+
103
+ Compute a **deviation rate** (deviations ÷ total proposals) per
104
+ milestone or per week of active work, from the session log's PASS/
105
+ DEVIATION history — but compute it **per error class, not only as one
106
+ overall number**. An overall rate can look flat or falling while one
107
+ specific class of mistake (e.g. `unverified-claim`) keeps recurring
108
+ underneath it, masked by other classes improving. Track each class's own
109
+ count and trend.
110
+
111
+ This is not a score to game — it's a trend to show the user
112
+ periodically. A falling rate on a given class is evidence the rule
113
+ governing that class is working. A flat or rising rate on the *same
114
+ class* is itself worth raising directly with the user ("we've hit
115
+ `interface-assumption` deviations three times — worth revisiting the
116
+ spec instead of patching the code again?") rather than silently logging
117
+ a fourth entry. A single self-administered test run (one evaluator
118
+ writing both the rules and the test cases) will tend to show artificially
119
+ low deviation rates across every class — the strongest version of this
120
+ signal comes from real, independently-authored requests over real
121
+ elapsed sessions, not a single sitting's worth of self-designed probes.
122
+
123
+ ## Rule Hygiene
124
+
125
+ Accumulated rules must stay small enough to actually be re-read at every
126
+ pre-flight check. When new rules overlap or supersede older ones,
127
+ propose consolidating them (merge, generalize, or retire a rule the
128
+ project has outgrown) rather than letting the list grow without bound.
129
+ Consolidation is a medium-severity change — it goes through the normal
130
+ approval gate, so the user always sees what's being merged or dropped
131
+ and why.
132
+
133
+ ### Rule Review And Expiry
134
+
135
+ Rules do not stay correct forever — a codebase changes underneath them.
136
+ At a natural review point (a new plan's Spec-authoring stage is a good
137
+ default trigger, since it already re-reads project context), check each
138
+ `active` rule against current reality:
139
+
140
+ - **Still applies, unchanged** — leave it.
141
+ - **Superseded by a newer, more specific rule** — mark the old one
142
+ `retired`, with a one-line pointer to what replaced it. Do not delete
143
+ it (see Rule Provenance).
144
+ - **No longer applies** (the code/constraint it was about was removed or
145
+ changed) — mark it `retired` with the reason, through the normal
146
+ approval gate (this is itself a medium-severity change — retiring a
147
+ rule silently is how a stale rule's *absence* becomes a surprise
148
+ later).
149
+ - **Contradicts another active rule** — this is a Rule Hygiene failure
150
+ that should have been caught at consolidation time; surface it to the
151
+ user rather than silently picking a side.
152
+
153
+ A project's Accumulated Feedback Rules section should therefore be read,
154
+ in full, as "the currently active rules, plus a retired history below
155
+ them" — not assumed to be entirely live just because it's still in the
156
+ file.
157
+
158
+ ## Executable Persistence
159
+
160
+ The installed CLI implements this interface across sessions. Use
161
+ `sia capture --signal <type> --context <text> --severity <level>
162
+ --error-class <class>` for a DEVIATION and `sia record --outcome pass ...` for
163
+ a PASS. Events append to `.sia/events.jsonl`; approved provenance-bearing rules
164
+ live in `.sia/rules.json`; `sia preflight` loads applicable active rules; and
165
+ `sia convergence` computes overall and per-error-class rates. This executable
166
+ record is the durable source for the prose loop above.
@@ -0,0 +1,44 @@
1
+ # Questioning Mode & Approval Gates
2
+
3
+ Applies to every stage of the pipeline in `../AGENT.md`. This is the
4
+ mechanism that prevents premature completion — the failure mode SIA
5
+ exists to eliminate.
6
+
7
+ ## Batching Questions
8
+
9
+ - Ask *what* the user wants, not *how* to implement it.
10
+ - Collect every clarifying question you have for the current stage and
11
+ ask them together, in one message — never drip-feed interruptions.
12
+ - If new questions surface mid-stage, hold them until the next natural
13
+ batch point rather than interrupting again immediately, unless
14
+ continuing without an answer risks an irreversible action.
15
+
16
+ ## Severity Table
17
+
18
+ Every proposed action is tagged with a severity before it is presented:
19
+
20
+ | Severity | Examples | Behaviour |
21
+ |----------|----------|-----------|
22
+ | Low | Rename a variable, fix a typo, reword a sentence in a draft | Proceed silently |
23
+ | Medium | Change a component's public props, alter an API shape, restructure a document section | Flag and batch for review |
24
+ | High | Delete data, change auth logic, modify production config, restructure a shared interface, send or publish a deliverable externally | Always require explicit approval before proceeding |
25
+
26
+ The threshold is configurable per project (state it in that project's
27
+ own `AGENT.md`) — a greenfield prototype can run more autonomously than
28
+ a production system with real users or a deliverable going to an
29
+ external client.
30
+
31
+ ## Non-Negotiable Rules
32
+
33
+ 1. Never assume on a non-trivial decision.
34
+ 2. Never delete, replace, or restructure anything on your own
35
+ initiative — propose an impact statement, then wait.
36
+ 3. Never declare a stage "done" until its acceptance criteria are met
37
+ *and* the user has approved any high-impact work within it.
38
+ 4. Surface creative/design decisions as options with trade-offs; narrow
39
+ the decision space, don't make the final call yourself.
40
+
41
+ An impact statement states the concrete consequence, not just the
42
+ action: "I'm going to delete the `users` table and recreate it with a
43
+ new schema. This will permanently drop all existing data. Proceed?" —
44
+ not "I'm updating the schema."
@@ -0,0 +1,40 @@
1
+ # Security Gate
2
+
3
+ The one fixed, reused pack in SIA. Threat classes don't vary per project
4
+ the way specs do, so this checklist is loaded as-is — never regenerated.
5
+
6
+ ## When To Load This Gate
7
+
8
+ Load this gate only when intake (`../AGENT.md` §Pipeline step 2) has
9
+ identified the current project as a software project — greenfield or
10
+ brownfield. Document/deck-prep and design projects do not load this
11
+ gate; their equivalent risk (leaking confidential material into a public
12
+ deliverable) is handled by the approval-gate severity table in
13
+ `questioning-and-approval.md` instead.
14
+
15
+ Run this checklist before any generated code is applied or executed —
16
+ not just before merge.
17
+
18
+ ## Threat Classes
19
+
20
+ - **XSS / JS injection** — `innerHTML`, `eval`, unsanitized input
21
+ rendered into the DOM.
22
+ - **SQL / command injection** — string-concatenated queries, template
23
+ literals or shell calls built from raw user input.
24
+ - **Prompt injection / jailbreak patterns** aimed at the LLM itself —
25
+ instructions embedded in untrusted data (user messages, fetched
26
+ documents, tool output) attempting to override system rules.
27
+ - **Hard-coded secrets** — API keys, tokens in URLs, credentials
28
+ committed to source, missing CORS/auth checks.
29
+ - **Unescaped LLM output** rendered to a user without sanitization.
30
+
31
+ ## On A Finding
32
+
33
+ 1. Do not apply the change as generated. Fix it before presenting it.
34
+ 2. Log what pattern caused it via `capture(signal_type, context, severity)`
35
+ (see `../capture-interface.md`), with `signal_type` set to
36
+ `security-finding`.
37
+ 3. Propose the finding as a standing rule for this project's own
38
+ `AGENT.md` (see `writing-agent-md.md`), so this project accumulates
39
+ its own vulnerability profile instead of re-deriving the same finding
40
+ next session.