@ghostbyte/agent-docs-kit 4.0.0 → 4.0.2

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.
@@ -62,7 +62,7 @@ gh api --method PUT repos/ghostbyte1014/Agent_Docs_Kit/pages -f build_type=workf
62
62
 
63
63
  ## 4. Prepare npm
64
64
 
65
- Create or sign in to the npm account that owns the `@ghostbyte1014` scope. Confirm package-name access and authentication:
65
+ Sign in to the npm account named `ghostbyte`, which owns the `@ghostbyte` personal scope. Confirm package access and authentication:
66
66
 
67
67
  ```powershell
68
68
  npm.cmd view @ghostbyte/agent-docs-kit name version
@@ -90,15 +90,23 @@ npx --yes @ghostbyte/agent-docs-kit@latest setup --dry-run
90
90
 
91
91
  ## 6. Configure trusted publishing
92
92
 
93
- In npm package settings, add a trusted publisher for GitHub Actions using the exact owner, repository, and workflow filename `.github/workflows/publish-npm.yml`. Configure a protected GitHub environment named `npm` if release approval is desired.
93
+ In npm package settings, add a trusted publisher for GitHub Actions with these values:
94
94
 
95
- After that, publish releases by updating the version, committing, creating a GitHub release, and allowing the workflow to use OIDC. No long-lived `NPM_TOKEN` is required.
95
+ | Field | Value |
96
+ |---|---|
97
+ | Organization or user | `ghostbyte1014` |
98
+ | Repository | `Agent_Docs_Kit` |
99
+ | Workflow filename | `publish-npm.yml` |
100
+ | Environment name | Leave blank |
101
+ | Allowed actions | Allow direct `npm publish` |
102
+
103
+ No npm token or GitHub environment is required. The workflow is restricted to this GitHub repository and workflow through OIDC.
104
+
105
+ After that, commit your changes, increment the npm version, and push to `main`. The push automatically validates and publishes the new version. No long-lived `NPM_TOKEN` is required.
96
106
 
97
107
  ```powershell
98
108
  npm.cmd version patch
99
109
  git push --follow-tags
100
- $version = node -p "require('./package.json').version"
101
- gh release create "v$version" --generate-notes
102
110
  ```
103
111
 
104
- Never reuse an existing npm version: registry versions are immutable. Use `npm deprecate` for a bad release and publish a corrected version.
112
+ Use `npm.cmd version minor` for a backward-compatible feature and `npm.cmd version major` for a breaking change. Never reuse an existing npm version: registry versions are immutable. Use `npm deprecate` for a bad release and publish a corrected version.
@@ -1,11 +1,22 @@
1
1
  # Release process
2
2
 
3
+ Published npm versions are immutable. A push can publish a new version, but it cannot replace the contents of an existing version.
4
+
3
5
  1. Update canonical content and run `npm run build` to refresh progressive skill references and the site.
4
6
  2. Run `npm test`, `npm run validate`, and `npm pack --dry-run`.
5
7
  3. Confirm the package archive contains no credentials, local reports, nested repositories, or generated consumer data.
6
- 4. Update the version with `npm version patch`, `minor`, or `major` according to compatibility.
7
- 5. Push the commit and tag, then create the matching GitHub release.
8
- 6. Let `.github/workflows/publish-npm.yml` publish through npm trusted publishing.
8
+ 4. Commit the package changes locally.
9
+ 5. Update the version with `npm version patch`, `minor`, or `major` according to compatibility.
10
+ 6. Push the commit and tag. A push to `main` runs `.github/workflows/publish-npm.yml` and publishes the new version through npm trusted publishing.
9
11
  7. Verify `npx --yes @ghostbyte/agent-docs-kit@<version> --help` from a clean directory.
10
12
 
11
- The first publish is manual because the npm package must exist before its trusted publisher can be configured.
13
+ ```powershell
14
+ git add -A
15
+ git commit -m "feat: describe the update"
16
+ npm.cmd version patch
17
+ git push --follow-tags
18
+ ```
19
+
20
+ Use `minor` for a backward-compatible feature and `major` for a breaking change. A GitHub Release is optional and does not control npm publication.
21
+
22
+ The first release was published manually because the package had to exist before its trusted publisher could be configured. If a pushed version already exists, the workflow validates the project and safely skips publication; increment the version before pushing package changes that should reach npm.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostbyte/agent-docs-kit",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Documentation governance, evidence-based security audits, and engineering-quality reviews for software projects.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +1,4 @@
1
- interface:
2
- display_name: "Agent Docs & Quality"
3
- short_description: "Govern docs and review project quality"
4
- default_prompt: "Use $manage-project-quality to set up project documentation or run an evidence-based security or engineering review."
1
+ interface:
2
+ display_name: "Agent Docs & Quality"
3
+ short_description: "Govern docs and review project quality"
4
+ default_prompt: "Use $manage-project-quality to set up project documentation or run an evidence-based security or engineering review."
@@ -1,1025 +0,0 @@
1
- # Agent Docs Kit v3.2 — Existing Feature Evolution: documentation, auditing, and session control
2
-
3
- **Created by:** ghostbyte1014
4
- **For:** an AI coding agent (Claude Code, Codex, Gemini CLI, Cursor, Copilot, or any other) setting this up in a project, and the developer who owns that project.
5
- **Origin:** adapted from ghostbyte1014's project process (October 1, 2026).
6
- **Version:** v3.2 — **Transparent Governance** (compiled edition, October 12, 2026).
7
- **Versioning:** Existing capabilities grouped retroactively into v1.x, v2.x, and v3.x so recipients can see the progression; these labels are not claims of independently published releases.
8
- **Defaults:** `FREEZE: OFF`, `CHANGE RECORDS: ON`, Philippine time (UTC+8), Git identity from `git config` (not proof of approval).
9
- **Purpose:** Provide a turnkey, transparent documentation, change-auditing, and session-governance foundation for AI-assisted coding projects—establishing clear scope boundaries, verifiable per-commit change records, a mandatory startup Session Gate, and human-in-the-loop developer approval before any project files are modified.
10
-
11
- > **Purpose & Foundation:**
12
- > This kit is a self-contained framework designed to give human developers full visibility and control when collaborating with AI coding agents (Claude Code, Codex, Gemini CLI, Cursor, Copilot, Antigravity, and others). It establishes:
13
- > - **Structured Documentation:** A standardized `docs/` hierarchy with clear status labels (`Current`, `Reference`, `Needs update`, `Archived`) and an authoritative scope baseline.
14
- > - **Verifiable Change Auditing:** Immutable, Philippine-time (UTC+8) change records for tracked code modifications to eliminate undocumented or silent agent edits.
15
- > - **Session-Level Governance (Session Gate):** A mandatory two-question startup sequence (`FREEZE` first, then `CHANGE RECORDS`) at the start of every new AI session, keeping the agent strictly read-only until the developer confirms policy.
16
- > - **Developer Approval Guardrails:** Change freeze rules requiring explicit permission before editing each file, backed by optional Git pre-commit hooks and audit scripts.
17
- >
18
- > **This is a foundation, not a fixed standard.** Refine it to fit your project and team: rename folders, add or drop sections, change the defaults, port the scripts to your stack. Please keep the `Created by ghostbyte1014` credit. **This kit edits no project until its developer approves the proposed installation files.**
19
-
20
- ---
21
-
22
- ## Complete version history — v1.0 through v3.2
23
-
24
- **Origin:** October 1, 2026. **Current compiled edition:** v3.2, October 12, 2026.
25
-
26
- The table below **divides functionality already present in this kit into nine named milestones**, so recipients can see what each stage contributes. This is a **retrospective feature breakdown, not proof of nine separately published historical releases**. Everything listed is included in this one compiled kit; nothing in the table is a future promise. The original v1.1 reliability work and v1.2 Session Gate work are preserved as source material; the names below reorganize their contents for presentation.
27
-
28
- | Version family | Subversion | Name | What it adds from the existing kit |
29
- |---|---|---|---|
30
- | **v1 — Documentation & Change Control** | **v1.0** | Documentation Foundation | Project docs layout, `docs/README.md` index, separate development/testing/operations/archive areas |
31
- | | **v1.1** | Scope & Status | Authoritative scope placeholder, `Current` / `Reference` / `Needs update` / `Archived` labels, scope verification before freeze |
32
- | | **v1.2** | Change Control | `AGENTS.md` rules, `FREEZE` and `CHANGE RECORDS` switches, per-file approvals, dated change-record template |
33
- | **v2 — Reliability & Git Enforcement** | **v2.0** | Commit Traceability | New change record per staged change/commit, baseline-based history checks, no reuse of older records |
34
- | | **v2.1** | Audit Integrity | Python/Node audit implementations, record metadata/path/date validation, append-only checks, fail-closed error handling |
35
- | | **v2.2** | Enforcement Toolkit | Optional Claude Code permissions (C1), Git audit (C2), pre-commit hook (C3), installation and verification instructions |
36
- | **v3 — Session Control & Governance** | **v3.0** | Session Gate | Mandatory **two separate startup questions**, Change Freeze first and Change Records second, for each new agentic coding session that loads the rules |
37
- | | **v3.1** | Persistent Settings | `ON`, `OFF`, or `Keep current setting` for each question; remain read-only until both answered; explicit approval, switch history, and record for persistent changes |
38
- | | **v3.2** | Transparent Governance | Cross-tool instruction pointers, setup/verification workflow, limitations of Markdown enforcement, optional hooks and Git controls, known bypass disclosures |
39
-
40
- **Version index (start → current):** v1.0 Documentation Foundation → v1.1 Scope & Status → v1.2 Change Control → v2.0 Commit Traceability → v2.1 Audit Integrity → v2.2 Enforcement Toolkit → v3.0 Session Gate → v3.1 Persistent Settings → **v3.2 Transparent Governance (current)**.
41
-
42
- **For the recipient:** The versions above explain how the **same existing feature set** is layered. Distributing the v3.2 compiled file includes all v1.x, v2.x, and v3.x features. They do not need to install nine different files or upgrade through nine releases. Actual distribution dates and published tags must be taken from release records, not inferred from these presentation labels. Future-version proposals belong in the accompanying changelog, not in this list of included features.
43
-
44
- ### Package updates and creator note
45
-
46
- - **Creator / package maintainer:** `ghostbyte1014`.
47
- - **Self-updates vs. official linear updates:**
48
- - **Independent / custom updates:** Recipients and AI agents have the full freedom to adapt, customize, or update the kit on their own to suit their project's requirements. However, independent local modifications mean the kit diverges from the creator's planned version tree; **such custom modifications are non-linear** and will affect how smoothly future official updates can be merged.
49
- - **Official linear updates:** If recipients prefer a standard **linear update** directly from the creator, they can request the next updated package from **ghostbyte1014**. The developer will prepare the update from the kit's changelog/evolution roadmap and supply the newly compiled Agent Docs Kit edition.
50
- - **Before replacing an installed version:** Check the package's version history, compare it with your project's custom rules and scripts, and obtain the project developer's approval for each proposed project-file change. **Do not automatically overwrite** `AGENTS.md`, agent settings, audit scripts, hooks, or other customized files.
51
- - **Current scope and claims:** The current compiled kit contains only the features listed through **v3.2**. Ideas listed under future proposals are not included functionality or promised release dates. An AI agent must not claim to have downloaded, installed, or updated the official kit unless it actually obtained and verified the new package from ghostbyte1014.
52
-
53
- ### v1 — What the foundations provide
54
-
55
- - A consistent documentation directory and index for actual system behavior, development notes, testing, operations, future enhancements, and historical archives.
56
- - Scope and document statuses that make it clear which text is authoritative and which is not yet verified.
57
- - The two persisted configuration switches and a repeatable, Philippine-time change-record format.
58
- - Scope-aware freeze rules requiring explicit permission before changing each file.
59
-
60
- ### v2 — What reliability adds
61
-
62
- - **Commit-scoped audits:** each staged change or post-baseline commit requires a **new** change record; older records cannot be reused.
63
- - **Index-aware checks:** the record and code must both be staged; previously committed records cannot be edited or deleted under the audit rules.
64
- - **Validated records:** filename, Philippine-time date consistency, required fields, types, exact paths, and verification sections are checked.
65
- - **Fail-closed audits and hooks:** missing runtime, invalid Git/baseline, or malformed metadata blocks the check rather than silently passing.
66
- - **Optional integration:** C1 Claude Code permissions, C2 Python or Node.js audit, and C3 pre-commit enforcement.
67
-
68
- ### v3 — What session control adds
69
-
70
- - **Mandatory two-question startup:** when the instructions load in a new coding session, ask Change Freeze and **then separately** Change Records. Each question has `ON`, `OFF`, and `Keep current setting` choices.
71
- - **Read-only until confirmed:** no mutation until both questions have answers and any requested persistent switch edits are separately approved and completed.
72
- - **Governed persistence:** changing a saved value requires approval for affected files, a switch-history entry, and a fresh governance change record—even when turning records OFF.
73
- - **Truthful limits:** this is an agent instruction, not a universal technical lock. Tool-specific startup guards can strengthen enforcement; Git hooks and CI are not automatically session-aware.
74
-
75
- ---
76
-
77
- ## Instructions to the agent (read all of this before doing anything)
78
-
79
- You have been given this file to set up a documentation and change-tracking process in **this** project. Follow these steps in order.
80
-
81
- ### Step 1. Look, don't touch
82
- Read the project first: its README, folder layout, existing `docs/` (if any), existing `AGENTS.md` / `CLAUDE.md` / `GEMINI.md` (if any), the tech stack (package manager, languages, framework), and whether it is a git repository. Reading changes nothing and needs no approval.
83
-
84
- ### Step 2. Ask the developer these installation questions (all at once, then wait)
85
- 1. **Project name** and a one-line description (used in the file headings).
86
- 2. **Documented scope:** what is the source of truth the code must match when the freeze is ON? (e.g., a thesis paper, a client spec, a PRD, `docs/01-system/overview/SCOPE.md`). If there is none yet, propose `docs/01-system/overview/SYSTEM_SCOPE.md` as a clearly marked **Needs update** placeholder, never as a verified Current scope. If an authoritative source already exists outside the repo, record where it lives and how it is kept in sync.
87
- 3. **Code paths to track:** propose a list based on what you found in Step 1 (e.g., `src/`, `app/`, `lib/`, `scripts/`, `migrations/`, `package.json`, `pyproject.toml`, build configs). Ask them to confirm or adjust. Ordinary documentation in `docs/` is not code-tracked; `AGENTS.md`, instruction pointers, hooks, audit scripts, and agent-permission files are protected governance paths.
88
- 4. **Docs folder 02:** the second docs folder is project-specific. Propose a name that fits (e.g., `02-thesis/` for thesis or paper work, `02-client/` for a client project, `02-product/` for a product). Ask them to pick.
89
- 5. **Existing docs and instruction files:** if any exist, propose whether to merge, move them into the new layout (with `git mv`), or leave them. Never overwrite an existing `AGENTS.md`, `CLAUDE.md`, or `GEMINI.md` without showing what will change.
90
- 6. **Optional enforcement add-ons** (Part C). Explain each one in a sentence, say whether it fits their stack, and ask which they want:
91
- - **C1. Claude Code lock** (`.claude/settings.json`): only matters if they use Claude Code.
92
- - **C2. Audit script**: lists code files changed without a change record. Offer the tested Node.js 18+ CommonJS version or Python 3.9+ version, regardless of app language, using whichever runtime is available in local development and CI.
93
- - **C3. Commit check** (pre-commit hook): blocks a commit while a code change has no record. Needs C2. Explain how it would be switched on for their stack (npm `prepare` script, a Makefile target, a setup script, or a one-time manual `git config`).
94
- - Also ask which **risky commands** in their stack should always need approval (e.g., `git push`, `npm install`, `pip install`, `prisma migrate`, `supabase`, `docker`, deploy commands).
95
- 7. **Audit baseline and Git workflow:** confirm current repository HEAD, whether the project uses merge/rebase, and whether local commits or CI will enforce records. Explain that the baseline is not retroactive and must never be moved to conceal missing records.
96
- 8. **Anything project-specific** to add to `AGENTS.md`: dev commands, data layer, design rules, things never to touch (e.g., `.env*`, production databases).
97
- 9. **Session Gate behavior:** explain that every *new* coding chat/session that reads the installed instructions asks **two separate startup questions, one after the other**, regardless of the current stored values. Developer choices are `ON`, `OFF`, and `Keep current setting` for each switch. A session remains read-only until both answers arrive. Ask whether the chosen coding tool supports a startup hook if hard enforcement is desired; do not promise that a Markdown instruction alone is a technical lock.
98
-
99
- ### Step 3. Propose the file list, then wait for "yes"
100
- List every file you will create or change (Part B, plus the add-ons they chose), one line each. Wait for an explicit "yes". If they say yes to only some, do only those.
101
-
102
- ### Step 4. Create the files from the templates in the kit
103
- Use the templates in Part B and Part C. Replace every `<PLACEHOLDER>` (including the audit baseline). Remove the template notes in `<!-- ... -->` comments. Keep the wording otherwise; the rules are deliberately exact. **Keep the `Created by ghostbyte1014` watermark** in every file that has one (the line under each heading, and the comment in the scripts and hook); do not remove, reword, or replace it with another name.
104
-
105
- ### Step 5. Record the setup itself
106
- Before creating the setup record, read the **full** current `HEAD` hash with `git rev-parse HEAD`; put it in C2 and in the records README. If there is no commit, explain that C2 history mode requires an initial commit and ask how to proceed; do not invent a baseline. Create the first change record (`docs/05-operations/agents/feature-updates/<timestamp>_agent-docs-kit-setup.md`) listing every file created or changed. Stage the setup files **and the new record in the same intended commit**, but **do not commit** unless explicitly asked. If C2 was installed, run `--staged` (after staging) and `--history`; any failure must be reported, never silently skipped.
107
-
108
- ### Step 6. Report and stop
109
- Tell the developer what was created, how to turn the freeze ON later (Part A), and to **start a new AI session** so supported tools load the new rules and the two-question Session Gate appears. Distinguish instruction-level startup prompts from a guaranteed technical lock. Do not commit or push unless they ask for that exact action.
110
-
111
- ---
112
-
113
- ## Part A. How the process works (summary for the developer)
114
-
115
- | Part | File | What it does | Default |
116
- |---|---|---|---|
117
- | Written rules | `AGENTS.md` | All agent rules: docs layout, change records, change freeze, two-question Session Gate | Always on |
118
- | Tool pointers | `CLAUDE.md`, `GEMINI.md` | One-line files that make Claude Code and Gemini CLI read `AGENTS.md` | Always on |
119
- | Docs index | `docs/README.md` | Every doc listed with a status; where new docs go | Always on |
120
- | Change records | `docs/05-operations/agents/feature-updates/` | One file per change: what, why, which files, which AI tool, who approved | **`CHANGE RECORDS: ON`** |
121
- | Change freeze | `AGENTS.md` section + guide | Agent asks before each file, flags anything new | **`FREEZE: OFF`** |
122
- | C1. Claude Code lock | `.claude/settings.off.json` (renamed to `settings.json` when ON) | Claude Code itself prompts for every edit and risky command | Optional |
123
- | C2. Audit script | `scripts/freezeAudit.cjs` or `scripts/freeze_audit.py` | Checks each staged change and each post-baseline commit against its own newly added record | Optional |
124
- | C3. Commit check | `.githooks/pre-commit` | Blocks a commit when staged tracked changes lack newly staged records | Optional |
125
-
126
- **Two switches, both in `AGENTS.md`:**
127
- - `**CHANGE RECORDS: ON**` / `OFF`: whether every code change needs a change record. The audit (C2) and commit check (C3) follow this switch.
128
- - `**FREEZE: ON**` / `OFF`: whether agents must ask before each file and flag anything outside the documented scope.
129
-
130
- **Session Gate, every new coding chat/session:** When an agent loads the installed `AGENTS.md`, it asks **Question 1 (Change Freeze)** and waits for an answer, then asks **Question 2 (Change Records)** and waits for an answer. For each question the developer may choose `ON`, `OFF`, or `Keep current setting`. Each question displays the value currently saved in `AGENTS.md`. Until both choices are confirmed, the agent may inspect/read but must not write or run mutating commands. `Keep current setting` does not modify files. If either value changes, obtain explicit permission for each affected governance file and follow the change-record/switch-history workflow before any regular coding edit. A new chat/session prompts again; individual messages **within the same already-confirmed session do not** require re-answering. A Markdown instruction cannot force every tool to comply: use a tool-specific startup hook/wrapper when technical enforcement is necessary.
131
-
132
- **Turning the freeze ON later:** change `**FREEZE: OFF**` to `**FREEZE: ON**` in `AGENTS.md`, rename `.claude/settings.off.json` to `.claude/settings.json` (if C1 is installed), add a row to the switch history and create a change record. Commit or push **only when explicitly requested**. Start a new AI session. Full steps are in `docs/05-operations/agents/CHANGE_FREEZE_GUIDE.md` (template B5).
133
-
134
- ---
135
-
136
- ## Part B. Core files (always created)
137
-
138
- ### B1. `AGENTS.md` (repository root)
139
-
140
- ~~~~markdown
141
- # <PROJECT NAME>: AGENTS.md
142
-
143
- > Created by ghostbyte1014 · Agent Docs Kit
144
-
145
- <One-line project description.>
146
-
147
- ## Switches (read before anything else)
148
-
149
- **CHANGE RECORDS: ON**
150
-
151
- **FREEZE: OFF**
152
-
153
- > The two switch values are persistent repository settings, not just chat preferences. A developer's startup choice does not override the stored values until an approved file change is made. When changing settings, start a new AI session after the change so tool instructions/permissions reload. The Claude Code lock is separate: `.claude/settings.json` is active, `.claude/settings.off.json` is inactive. Full guide: [`docs/05-operations/agents/CHANGE_FREEZE_GUIDE.md`](docs/05-operations/agents/CHANGE_FREEZE_GUIDE.md).
154
-
155
- These rules apply to **every AI coding agent** (Claude Code, Codex, Gemini CLI, Cursor, Copilot, or any other) **in every mode, including auto, auto-accept, full-access, YOLO, or "skip permissions"**. However, whether the tool actually loads and follows these rules is agent-dependent; text instructions alone cannot prevent edits in every tool.
156
-
157
- ## Mandatory Session Gate (at the start of every new coding chat/session)
158
-
159
- **When these instructions are loaded in a fresh agentic coding chat/session, ask exactly two distinct questions, sequentially. Do not combine them into one prompt or assume prior-session answers carry over.** If the chat context has already recorded answers to both questions, do not ask again for each subsequent message in that same session unless the developer requests a change.
160
-
161
- **Question 1 — Change Freeze:** display the saved value read from `AGENTS.md` and ask:
162
- > `Change Freeze is currently <ON/OFF>. For this session, do you want to turn it ON, turn it OFF, or Keep current setting?`
163
-
164
- **STOP and wait** for the developer's answer to Question 1. Do not ask Question 2 in the same message.
165
-
166
- **Question 2 — Change Records:** after the first answer, display its saved value and ask:
167
- > `Change Records is currently <ON/OFF>. For this session, do you want to turn it ON, turn it OFF, or Keep current setting?`
168
-
169
- **STOP and wait** for the developer's answer to Question 2.
170
-
171
- - Until **both** answers have been explicitly provided, **READ-ONLY MODE** applies: inspect/search/describe files and run genuinely read-only checks only. Do not create/edit/delete files, stage, commit, push, install packages, change Git config, migrate databases, or perform any other mutating operation. Never infer an answer from silence, auto mode, or the previous session.
172
- - `Keep current setting` means the persisted `AGENTS.md` value remains unchanged. An answer of `ON` or `OFF` that equals the stored value also needs no file change.
173
- - If a requested value differs from the stored value, explain the exact required edits (`AGENTS.md`, a switch-history row in `docs/05-operations/agents/CHANGE_FREEZE_GUIDE.md`, C1 permission-file rename if installed, and a **new** change record). Request explicit approval to modify **each** affected file; until the approved changes are written, obey the currently stored restrictions and do not make regular code changes. If approval is withheld or the update cannot be completed, remain read-only and report the mismatch. Never present a chat-only choice as a switch that already changed Git audit behavior.
174
- - Log a new record for each switch-change transaction even if `CHANGE RECORDS` is being switched OFF. This is a **policy obligation**, not a guarantee from the included C2 script: that script skips record coverage when the staged switch is OFF. For tamper-resistant control, enforce switch-change policies separately in protected CI/branch rules.
175
- - When both choices match persisted settings, acknowledge the two settings and proceed using the stored rules. If updated, verify that the persisted files agree before proceeding. Ask the two questions again in the **next** fresh coding chat/session.
176
- - Do not claim startup gating is universally enforced: a tool must read these instructions, and strict enforcement across all tools requires tool-specific hooks or a launcher that blocks mutation before confirmation.
177
-
178
- ## Change records (when CHANGE RECORDS is ON)
179
-
180
- After every change to code (<TRACKED CODE PATHS>) or protected agent-governance files (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.githooks/`, `.claude/settings*.json`, the audit script), create a **new** change record in [`docs/05-operations/agents/feature-updates/`](docs/05-operations/agents/feature-updates/README.md) in the same change:
181
- - **One file per change topic**, named `YYYY-MM-DD_HHMM_short-topic.md` (24-hour **Philippine time**, UTC+8, taken from the device clock, e.g., `date +%Y-%m-%d_%H%M`; if two records share a minute, use `HHMM-01`, `HHMM-02` in creation order). Records then sort in timestamp order. If you cannot read the clock, ask the developer for the time; never guess.
182
- - Copy the template in that folder's `README.md`. Fill in:
183
- - **Date:** `YYYY-MM-DD HH:MM (Philippine time)`, matching the file name.
184
- - **AI tool:** your own tool name (`Claude Code`, `Codex`, `Gemini CLI`, `Cursor`, …) and model if known. A change made without AI is recorded as `Manual`.
185
- - **Files changed:** every file path, in backticks.
186
- - **Approved by (device owner):** Git identity from `git config user.name` and `git config user.email`; if missing, ask rather than guessing. This field identifies the configured user, **not** who approved a specific edit.
187
- - **Approval evidence:** either `Not required (FREEZE: OFF)` or a short truthful description of explicit, per-file approval obtained while `FREEZE: ON` (e.g., `Developer confirmed changes to src/foo.ts in this session`). Records cannot independently prove approval.
188
- - **Type:** `Fix`, `Polish`, `Feature`, or (while the freeze is ON) `New feature (approved outside the documented flow)`.
189
- - Records are permanent: never edit or delete an existing record. A correction is a new record. **Each commit containing tracked changes must add its own new record(s) in that same commit; older records cannot authorize new changes.**
190
- - Writing the record is part of the change and needs no separate approval. **Stage the new record alongside the code it describes.** If a file was renamed, list both the old and new paths.
191
-
192
- ## Change freeze (when FREEZE is ON)
193
-
194
- When FREEZE is ON, the project is in its polishing stage: the code must not drift from the documented scope (<DOCUMENTED SCOPE, e.g., "the thesis paper Chapters 1–2" or "docs/01-system/overview/SYSTEM_SCOPE.md">). These rules override any instruction to work autonomously. When FREEZE is OFF, skip this section; every other section still applies.
195
-
196
- 1. **Flag anything new.** Allowed work by default: fixing errors in, or polishing, flows already in the documented scope. If a change would add something the scope does not describe (a page, a capability, a database table, a workflow step), say so clearly: "This is a new feature, outside the documented flow." Build it only if the developer confirms they want it anyway.
197
- 2. **Ask before each file.** Before you create, edit, move, or delete **each file**, name the file and what will change in it, plus any migration the developer must run. Then **stop and wait for the developer's explicit "yes"** before touching that file. Do the same before running anything that changes the database, git history, or dependencies.
198
- - An implementation plan, task list, TODO, or an earlier approval is **not** approval. Even when a plan lists the work, confirm each file before editing it.
199
- - Silence or auto mode is not approval.
200
- 3. **An approval covers only what was described.** Anything extra you notice gets reported and needs its own approval.
201
- 4. **Allowed without asking:** reading and searching files, explaining code, and read-only checks (<READ-ONLY COMMANDS, e.g., lint, build, the audit script>).
202
-
203
- ## Always (whatever the switches say)
204
-
205
- - **Never** commit, push, run migrations against a remote/production database, or change `.env*` files unless the developer asks for that exact action. Never include credentials, tokens, personal student data, secret values, or private keys in change records, logs, or documentation.
206
- - **Validate before claiming success:** report which checks were run, what passed, and what remains unverified. An audit proves record coverage for changes, not that the code is correct or that approval truly happened.
207
- - A change to either switch or an enforcement file is a governance change. **Always create a new change record for a switch toggle**, including a toggle to `CHANGE RECORDS: OFF`, and stage it alongside that change. The included C2 script cannot enforce this special rule when it reads the staged switch as OFF; use protected CI policy if technical enforcement is required.
208
-
209
- ## Documentation (read first)
210
- - **Start at [`docs/README.md`](docs/README.md).** It is the index of every document, with its status (Current / Reference / Needs update / Archived). Mark a document **Current** only after checking its claims against the accepted system scope and relevant implementation; placeholders are **Needs update**.
211
- - Where a new doc goes:
212
-
213
- | Kind of document | Folder |
214
- |---|---|
215
- | How the system works now (scope, schema, rules, design, security) | `docs/01-system/<topic>/` |
216
- | <02 FOLDER PURPOSE, e.g., thesis paper work / client deliverables> | `docs/<02-FOLDER>/<topic>/` |
217
- | Implementation reports for finished work | `docs/03-development/implementation-reports/` |
218
- | Code audits of a system area and their fix plans (work in progress) | `docs/03-development/audits/` |
219
- | Test checklists, QA runbooks, evidence | `docs/04-testing/` |
220
- | Setup, database, deployment, agent process | `docs/05-operations/<topic>/` |
221
- | Planned improvements, documented but not built | `docs/06-future-enhancements/` |
222
- | Superseded, completed, or rejected material | `docs/archive/<era-or-kind>/` |
223
-
224
- - Name dated docs `TOPIC_YYYY-MM-DD.md`; living docs `TOPIC.md`. Do not create `.md` files in the repo root (only `README.md`, `AGENTS.md`, and the one-line `CLAUDE.md`/`GEMINI.md` pointers live there).
225
- - Every time you add, move, archive, or retire a doc, update `docs/README.md` in the same change.
226
- - **`docs/archive/` is historical, not authoritative.** Do not use it as a source of truth or audit against it.
227
- - Move files with `git mv` so history is kept, then fix relative links.
228
-
229
- <!-- Project-specific sections go below: Dev Commands, Architecture, Data Layer, Design Rules, etc. -->
230
- ~~~~
231
-
232
- ### B2. `CLAUDE.md` (repository root)
233
-
234
- ~~~~markdown
235
- # <PROJECT NAME>: Claude Code instructions
236
-
237
- > Created by ghostbyte1014 · Agent Docs Kit
238
-
239
- All project rules live in AGENTS.md. At the start of every new coding chat/session, load AGENTS.md and ask its TWO Session Gate questions SEPARATELY (Change Freeze first; Change Records second). Stay read-only until both are answered. Then follow its change-record rules and, when freeze is ON, its per-file approval rules, even in auto mode.
240
-
241
- @AGENTS.md
242
- ~~~~
243
-
244
- ### B3. `GEMINI.md` (repository root)
245
-
246
- ~~~~markdown
247
- # <PROJECT NAME>: Gemini CLI instructions
248
-
249
- > Created by ghostbyte1014 · Agent Docs Kit
250
-
251
- All project rules live in AGENTS.md. At the start of every new coding chat/session, load AGENTS.md and ask its TWO Session Gate questions SEPARATELY (Change Freeze first; Change Records second). Stay read-only until both are answered. Then follow its change-record rules and, when freeze is ON, its per-file approval rules, even in auto/YOLO mode.
252
-
253
- @AGENTS.md
254
- ~~~~
255
-
256
- ### B4. `docs/README.md`
257
-
258
- ~~~~markdown
259
- # <PROJECT NAME> Documentation Index
260
-
261
- > Created by ghostbyte1014 · Agent Docs Kit
262
-
263
- Every document in `docs/` is listed here with its status. **Agents and contributors: read this first**, and update this index in the same change whenever a doc is added, moved, archived, or retired.
264
-
265
- **Status legend**
266
- - **Current**: verified against accepted scope and relevant implementation on the stated date; authoritative for the documented area.
267
- - **Reference**: still useful and accurate in principle, but not the primary source.
268
- - **Needs update**: still the right place for this topic, but parts are out of date. Trust the code over it.
269
- - **Archived**: historical only (see [`archive/README.md`](archive/README.md)).
270
-
271
- **Where a new doc goes**
272
-
273
- | Kind of document | Folder | Naming |
274
- |---|---|---|
275
- | How the system works now | `01-system/<topic>/` | `TOPIC.md` (living doc) |
276
- | <02 FOLDER PURPOSE> | `<02-FOLDER>/<topic>/` | `TOPIC_YYYY-MM-DD.md` |
277
- | Report on finished implementation work | `03-development/implementation-reports/` | `TOPIC_YYYY-MM-DD.md` |
278
- | Code audit of a system area, with its fix plan | `03-development/audits/` | `TOPIC_YYYY-MM-DD.md` |
279
- | Test checklist, QA runbook, evidence | `04-testing/` | `TOPIC_YYYY-MM-DD.md` |
280
- | Setup, database, deployment, agent process | `05-operations/<topic>/` | `TOPIC.md` |
281
- | Planned improvements, documented but not built | `06-future-enhancements/` | `TOPIC_YYYY-MM-DD.md` |
282
- | Superseded, completed, or rejected | `archive/<era-or-kind>/` | keep original name |
283
-
284
- Do not add `.md` files to the repository root. The root holds only `README.md`, `AGENTS.md` (all agent rules), and the one-line `CLAUDE.md`/`GEMINI.md` pointers to it.
285
-
286
- ---
287
-
288
- ## 01 · System: how <PROJECT NAME> works now
289
-
290
- | Document | Status | Notes |
291
- |---|---|---|
292
- | [overview/SYSTEM_SCOPE.md](01-system/overview/SYSTEM_SCOPE.md) | Needs update | Placeholder until approved and checked against the accepted project scope. Change to Current only after verification. |
293
-
294
- ## 02 · <02 FOLDER TITLE>
295
-
296
- | Document | Status | Notes |
297
- |---|---|---|
298
-
299
- ## 03 · Development: audits and implementation reports
300
-
301
- | Document | Status | Notes |
302
- |---|---|---|
303
-
304
- ## 04 · Testing
305
-
306
- | Document | Status | Notes |
307
- |---|---|---|
308
-
309
- ## 05 · Operations
310
-
311
- | Document | Status | Notes |
312
- |---|---|---|
313
- | [agents/CHANGE_FREEZE_GUIDE.md](05-operations/agents/CHANGE_FREEZE_GUIDE.md) | Current | How change records and the change freeze work, and how to switch them. |
314
- | [agents/feature-updates/](05-operations/agents/feature-updates/README.md) | Current | One change record per change, with the template. |
315
-
316
- ## 06 · Future enhancements
317
-
318
- | Document | Status | Notes |
319
- |---|---|---|
320
-
321
- ## Archive
322
-
323
- See [`archive/README.md`](archive/README.md).
324
- ~~~~
325
-
326
- Also create `docs/archive/README.md`:
327
-
328
- ~~~~markdown
329
- # Archive
330
-
331
- > Created by ghostbyte1014 · Agent Docs Kit
332
-
333
- Historical material only: superseded, completed, or rejected documents. **Not authoritative.** Do not use anything here as a source of truth or audit against it. Each subfolder is named by era or kind (e.g., `2026-10_old-design/`).
334
- ~~~~
335
-
336
- If a verified source-of-truth document already exists, replace the example index row above with a link and its actual status; do **not** create a duplicate. Otherwise create the following starter placeholder (its status remains **Needs update**):
337
-
338
- ### B4a. `docs/01-system/overview/SYSTEM_SCOPE.md` (only if no authoritative scope exists)
339
-
340
- ~~~~markdown
341
- # <PROJECT NAME> — System Scope
342
-
343
- > Created by ghostbyte1014 · Agent Docs Kit
344
-
345
- **Status:** Needs update — **NOT YET APPROVED OR VERIFIED**.
346
- **Authoritative external source (if any):** <name/path/link, or None yet>.
347
-
348
- ## In scope
349
- <Developer must specify existing, approved features and workflows.>
350
-
351
- ## Out of scope / future
352
- <Developer must distinguish prototypes and future features.>
353
-
354
- ## Source verification
355
- <References to accepted specification, implementation paths, and verification date.>
356
-
357
- **Do not enable a scope-dependent freeze until this document, or another cited scope, has been reviewed and accepted.**
358
- ~~~~
359
-
360
- Create other folders only when they receive documents (git does not track empty folders).
361
-
362
- ### B5. `docs/05-operations/agents/CHANGE_FREEZE_GUIDE.md`
363
-
364
- <!-- Agent: keep only add-ons that were selected; adapt commands and hooks to the installed audit language. -->
365
-
366
- ~~~~markdown
367
- # Change Freeze Guide: change records and AI-agent safeguards
368
-
369
- > Created by ghostbyte1014 · Agent Docs Kit
370
-
371
- **Audience:** <PROJECT NAME> owner and contributors using AI coding tools.
372
- **Status:** Current. Change records: **ON**. Freeze: **OFF** (since <SETUP DATE>). Session Gate: **ON** (two separate confirmations required per new coding chat/session).
373
-
374
- ## 1. Purpose and switches
375
-
376
- `AGENTS.md` contains two independent switches:
377
- - **`CHANGE RECORDS: ON`** requires a *new* append-only record for tracked code or governance changes in each commit. Records describe the change and identify the configured Git user; Git identity is **not proof of authorization**.
378
- - **`FREEZE: ON`** restricts agent work to approved documented scope and requires explicit developer approval **before each file edit**, even in auto modes. Additional or out-of-scope features require separate approval.
379
-
380
- Written rules are instructions, **not a universal technical lock**. Permissions depend on the installed agent; Git hooks check staged commits, not every workspace edit. Never commit, push, change secrets, or run remote migrations without a developer request for that action.
381
-
382
- ### Mandatory Session Gate (v3.0–v3.2) — two separate questions
383
-
384
- Each **new coding chat/session that reads `AGENTS.md`** must ask, one at a time:
385
-
386
- 1. **Question 1, Change Freeze:** `Currently <ON/OFF>. Turn ON / Turn OFF / Keep current setting?` Then **wait for the answer**.
387
- 2. **Question 2, Change Records:** `Currently <ON/OFF>. Turn ON / Turn OFF / Keep current setting?` Then **wait for the answer**.
388
-
389
- Never combine the questions. Never substitute choices from a previous session. No mutation is allowed until **both** questions are answered. Reading and genuinely read-only checks may continue. This check runs once per **new** chat/session, not after every message inside an already-confirmed session.
390
-
391
- `Keep current setting` changes nothing. If the answer differs from `AGENTS.md`, chat confirmation is **not** yet an effective policy switch: get per-file approval, update the persisted switch, add a row to section 8 and a **fresh governance record**, and handle `.claude/settings*.json` if C1 is installed. A toggle to `CHANGE RECORDS: OFF` still requires a record as a process rule, although the supplied C2 script cannot enforce it once the staged switch is OFF. Do not perform regular edits when the desired and persisted settings disagree; report the mismatch if a switch update is not approved.
392
-
393
- **Technical limit:** These prompts are instruction-based. For assured startup blocking, implement and test a supported agent-specific startup hook or launcher. Neither Git hooks nor this Markdown file guarantees every agent will ask before editing.
394
-
395
- ## 2. Components
396
-
397
- | Part | Files | Enforcement |
398
- |---|---|---|
399
- | Agent policy | `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` | Instruction-based, agent dependent |
400
- | Documentation map | `docs/README.md` | Human-reviewed status labels |
401
- | New change record per topic | `docs/05-operations/agents/feature-updates/` | Append-only by policy; checked by C2/C3 if installed |
402
- | C1, optional | `.claude/settings.off.json` / `.claude/settings.json` | Claude Code only; verify effective permissions locally |
403
- | C2, optional | `scripts/freeze_audit.py` **or** `scripts/freezeAudit.cjs` | Commit-scoped Git audit |
404
- | C3, optional | `.githooks/pre-commit` | Refuses staged changes without a newly staged record, unless records deliberately switched OFF; bypassable |
405
-
406
- ## 3. Workflow for one change
407
-
408
- 0. Complete both separate Session Gate questions and, if needed, approved persistent switch changes before doing regular work.
409
- 1. When freeze is ON, identify the exact file and intended edit, check whether it belongs to the documented scope, and obtain an explicit **yes for that file**. A plan or an earlier general yes is not sufficient.
410
- 2. Implement only the approved change. Do not run migrations or install dependencies without their own authorization.
411
- 3. Create a **new** `YYYY-MM-DD_HHMM_topic.md` record (Philippine time) with actual files changed, reason, tool, Git identity, truthful approval evidence, and how to verify.
412
- 4. Stage the code **and** new record together. Do not stage or commit unrelated changes without authorization.
413
- 5. Run `<AUDIT COMMAND> --staged`. A previously committed record never satisfies this step.
414
- 6. Commit only if the developer explicitly requested it. With C3 installed, the hook checks the staged snapshot again.
415
-
416
- Record corrections in a **new** record. Never edit or delete a previously committed record. When moving code files, list both old and new paths.
417
-
418
- ## 4. Turning freeze ON or OFF
419
-
420
- 1. Ask for explicit developer approval to change `AGENTS.md` and each other affected file.
421
- 2. Toggle `**FREEZE: OFF**` / `**FREEZE: ON**` in `AGENTS.md`.
422
- 3. If C1 is installed, move `.claude/settings.off.json` to `.claude/settings.json` when turning ON; reverse when turning OFF. Merge existing settings rather than overwriting them.
423
- 4. Add a dated row to section 8 below; create a new change record for the switch or permission-file change **even when turning `CHANGE RECORDS` OFF**. Stage the changes and the record together; note that the supplied C2 check does not enforce records when the staged setting is OFF.
424
- 5. **Do not reset the audit baseline merely to toggle freeze.** Keep the historical baseline so previously audited changes stay covered.
425
- 6. Commit or push **only on explicit instruction** and restart AI sessions so the new rules are loaded. Verify permission behavior with a harmless test.
426
-
427
- Turning `CHANGE RECORDS` OFF intentionally disables C2/C3 coverage for commits made with that setting, including enforcement of its own OFF-switch record. A separate protected CI rule is needed for non-bypassable governance-switch coverage. Restore ON with an explicit documented change; do not move the baseline to hide missing records. If a legitimate reset is needed, document why, what history becomes unaudited, and obtain approval.
428
-
429
- ## 5. Audit modes (C2)
430
-
431
- ```bash
432
- <AUDIT COMMAND> --staged
433
- <AUDIT COMMAND> --history
434
- <AUDIT COMMAND> --working
435
- ```
436
-
437
- - **`--staged` (pre-commit):** inspects Git's staged snapshot only, requires a **newly added and staged** record covering each tracked path, and rejects modifying/deleting older records. Files in a record must be among files changed in that staged snapshot. No old record can be reused.
438
- - **`--history` (post-commit/CI):** checks every commit on the **first-parent history** after `<BASELINE COMMIT>`, comparing each commit with its first parent. Each commit changing tracked paths must itself add a record. A merge is audited for the overall changes it introduces against the first parent. Already-existing older records do not count.
439
- - **`--working` (diagnostic):** reports unstaged or untracked tracked files that cannot yet be verified as part of a commit; it is not used in the pre-commit hook.
440
- - With no flag, run `--staged` and `--history` together. Broken Git commands, missing `AGENTS.md`, invalid baseline, or malformed record metadata **fail rather than silently passing**.
441
- - The audit tracks `<TRACKED CODE PATHS>` plus central agent-governance files; ordinary `docs/` prose is excluded. New change records themselves are checked for validity and immutability.
442
- - Date field must match filename in Philippine time. The audit checks consistency, **not whether a device clock, claimed authorization, or change description is truthful**.
443
-
444
- **Baseline limitations:** History before the baseline is intentionally not checked. `--history` needs an existing full commit SHA that is an ancestor of HEAD. First-parent auditing is designed for a protected mainline; use CI on your protected branch and adopt merge rules that preserve change records. Avoid squashing away records without corresponding coverage.
445
-
446
- ## 6. Commit check (C3)
447
-
448
- The pre-commit hook runs **`--staged`**, not a diff of the entire working directory. This means it checks exactly what the commit would contain. A record left unstaged does **not** count. A commit touching only ordinary `docs/` files does not need a change record, except that any newly added record is still checked for valid content.
449
-
450
- Activate after inspecting an existing hook manager, if any:
451
-
452
- ```bash
453
- git config core.hooksPath .githooks
454
- git config --get core.hooksPath
455
- ```
456
-
457
- Install the hook using the **runtime selected for the project**. If that runtime or Git is missing, the hook rejects the commit with a clear error. `git commit --no-verify` still bypasses local hooks, so protect branches and run `<AUDIT COMMAND> --history` in CI where possible. CI is not a substitute for file-by-file approval under freeze.
458
-
459
- ## 7. Verification checklist
460
-
461
- - With records ON, staged code without a new staged record **fails**.
462
- - A valid new record staged with the code **passes**.
463
- - Re-editing a previously documented file without a fresh record **fails**.
464
- - Modifying/deleting an existing record **fails**.
465
- - A record describing a file that is not staged **fails**.
466
- - A deleted/renamed tracked path needs coverage (for renames, list both old and new paths).
467
- - Bad timestamps, missing mandatory fields, or unavailable runtime **fail**.
468
- - With records OFF, coverage is deliberately skipped; this is an **administrative bypass**, not an audit guarantee.
469
- - Every new coding session asks **two separate startup questions** in order; the second is withheld until the first is answered, and no mutating operation occurs before both answers.
470
- - Each question offers `ON`, `OFF`, and `Keep current setting`; selecting Keep leaves `AGENTS.md` untouched.
471
- - If a changed selection is not approved for persistence, regular code editing stays blocked and the mismatch is reported.
472
- - When freeze ON, after both startup answers, request a tiny file change; confirm it asks for explicit per-file approval before writing.
473
-
474
- ## 8. Switch history
475
-
476
- | Date (PH) | Switch | Value | Git identity | Reason / approval |
477
- |---|---|---|---|---|
478
- | <SETUP DATE> | CHANGE RECORDS | ON | <git identity> | Kit installed with developer consent |
479
- | <SETUP DATE> | FREEZE | OFF | <git identity> | Development mode; freeze later after scope verification |
480
-
481
- ## 9. Additional safeguards
482
-
483
- - Protect the default branch with pull-request review and mandatory CI checks, when available.
484
- - Limit who can edit `AGENTS.md`, permission files, audit scripts, and hooks (for example, codeowners/reviewers).
485
- - Keep sensitive credentials and private personal data out of change records and console logs.
486
- - Check the **Current** label against code and accepted scope; move stale or unapproved material to **Needs update**.
487
- - Never claim the audit proves code correctness or approval authenticity; it checks only scoped Git changes and record structure.
488
- ~~~~
489
-
490
- ### B6. `docs/05-operations/agents/feature-updates/README.md`
491
-
492
- ~~~~markdown
493
- # Feature updates: change records
494
-
495
- > Created by ghostbyte1014 · Agent Docs Kit
496
-
497
- When `CHANGE RECORDS: ON` in `AGENTS.md`, every commit affecting tracked code or central governance files must add its own new record(s). Read [`../CHANGE_FREEZE_GUIDE.md`](../CHANGE_FREEZE_GUIDE.md).
498
-
499
- ## Rules
500
-
501
- - **One new file per topic**, in the same staged commit as the change it describes. Older records never cover future edits to the same path.
502
- - **Name:** `YYYY-MM-DD_HHMM_short-topic.md` (24-hour **Philippine time**, UTC+8). Two created in the same minute use `HHMM-01`, `HHMM-02`. Use the actual current PH date/time; never guess.
503
- - **Date line:** `YYYY-MM-DD HH:MM (Philippine time)`, exactly matching the filename. Valid actual date/time is checked.
504
- - **Files changed:** one exact backticked repository-relative path per line. List only files actually in this staged change; for moves/renames include both the old and new path.
505
- - **AI tool:** actual agent + model if known; `Manual` if no agent was involved.
506
- - **Approved by (device owner):** output of `git config user.name` and `git config user.email`; ask if missing. This is Git identity, not approval proof.
507
- - **Approval evidence:** record `Not required (FREEZE: OFF)` or a short factual summary of the developer's explicit per-file approval when freeze is ON. The audit checks presence, **not authenticity**.
508
- - **Type:** exactly `Fix`, `Polish`, `Feature`, or `New feature (approved outside the documented flow)`.
509
- - **Migration:** write the affected migration and status, or `None`. Do not run remote migrations without specific authorization.
510
- - **Append-only:** never edit or delete existing records, even to fix a typo. Use another new record to document a correction.
511
- - **No sensitive data:** don't include secrets, credentials, private student records, or access tokens.
512
-
513
- **Audit baseline:** commit `<BASELINE COMMIT>` (<SETUP DATE>). Only commits after that baseline are checked by `--history`; `--staged` checks newly staged changes regardless of the baseline. Never reset the baseline to conceal a failure.
514
-
515
- ## Template
516
-
517
- Copy into a **new** file, replace every placeholder, and stage it with the change:
518
-
519
- ```markdown
520
- # <Short title>
521
-
522
- - **Date:** YYYY-MM-DD HH:MM (Philippine time)
523
- - **AI tool:** <Actual tool, model if known, or Manual>
524
- - **Approved by (device owner):** <git user.name> (<git user.email>)
525
- - **Approval evidence:** Not required (FREEZE: OFF) | <Explicit developer approval and exact file scope if freeze ON>
526
- - **Type:** Fix | Polish | Feature | New feature (approved outside the documented flow)
527
- - **Migration:** None | <file and applied/to apply>
528
-
529
- ## Files changed
530
- - `path/to/file`
531
-
532
- ## What changed and why
533
- <Describe the affected flow and actual modifications.>
534
-
535
- ## How to verify
536
- <Commands or steps actually used; identify unverified checks.>
537
- ```
538
- ~~~~
539
-
540
- ## Part C. Optional enforcement add-ons (ask the developer first)
541
-
542
- Install only what the developer chose in Step 2. Adapt paths and commands to their stack, and show them the adapted version before writing it.
543
-
544
- ### C1. Claude Code lock
545
-
546
- Create it **inactive** (freeze is OFF): save as `.claude/settings.off.json`. Turning the freeze ON renames it to `.claude/settings.json`. If the project already has a `.claude/settings.json` with other settings, ask how to merge before doing anything.
547
-
548
- Replace the stack-specific `Bash(...)` lines with the risky commands the developer named.
549
-
550
- ```json
551
- {
552
- "permissions": {
553
- "ask": [
554
- "Edit",
555
- "Write",
556
- "MultiEdit",
557
- "NotebookEdit",
558
- "Bash(git commit:*)",
559
- "Bash(git push:*)",
560
- "Bash(git reset:*)",
561
- "Bash(git checkout:*)",
562
- "Bash(npm install:*)"
563
- ],
564
- "disableBypassPermissionsMode": "disable"
565
- }
566
- }
567
- ```
568
-
569
- ### C2. Audit script
570
-
571
- Use **one** of the two tested, standard-library implementations below. Both enforce the same contract. Confirm runtime availability and tracked paths before installation; adjust only the `CODE_PATHS` expression after inspecting the project. `PROTECTED_PATHS` safeguards the central governance files. Do not edit the existing repository's records or history to make the audit pass.
572
-
573
- **Design:** `--staged` checks tracked paths against records newly added to the **Git index** (not records merely present in the working tree); `--history` checks commits individually after a selected baseline; `--working` identifies unstaged/untracked code without treating older records as coverage. A record's required metadata and exact changed-path lines are also checked. When records are ON, errors fail closed.
574
-
575
- Before installing, set `BASELINE` to the full, existing `git rev-parse HEAD` hash **as it was before the kit changes**. If no commit exists, get developer approval to establish an initial commit before enabling history mode. Avoid rebasing or changing the baseline merely to conceal a gap. Use repository-relative paths and run from the repository root.
576
-
577
- **Python 3.9+** — `scripts/freeze_audit.py`:
578
-
579
- ```python
580
- """Agent Docs Kit — commit-scoped change-record audit.
581
- Created by ghostbyte1014 · Agent Docs Kit
582
- Python 3.9+, standard library only. Run from the Git repository root.
583
- """
584
- import argparse
585
- import datetime as dt
586
- import pathlib
587
- import re
588
- import subprocess
589
- import sys
590
-
591
- BASELINE = '<BASELINE COMMIT>' # Set when installing. Required only for --history.
592
- RECORDS_DIR = 'docs/05-operations/agents/feature-updates/'
593
- CODE_PATHS = re.compile(r'^(src/|app/|lib/|scripts/|migrations/|supabase/|package\.json$|pyproject\.toml$|requirements\.txt$)') # ADAPT
594
- PROTECTED_PATHS = re.compile(r'^(AGENTS\.md$|CLAUDE\.md$|GEMINI\.md$|\.githooks/|\.claude/settings(?:\.off)?\.json$)')
595
- RECORD_NAME = re.compile(r'^(\d{4}-\d{2}-\d{2})_(\d{4})(?:-\d{2})?_[a-z0-9][a-z0-9-]*\.md$')
596
- VALID_TYPES = {'Fix', 'Polish', 'Feature', 'New feature (approved outside the documented flow)'}
597
-
598
-
599
- def git(*args):
600
- result = subprocess.run(['git', *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
601
- if result.returncode:
602
- raise RuntimeError(f"git {' '.join(args)} failed: {result.stderr.decode('utf-8', 'replace').strip()}")
603
- return result.stdout
604
-
605
-
606
- def paths(*args):
607
- return [s.decode('utf-8', 'surrogateescape') for s in git(*args).split(b'\0') if s]
608
-
609
-
610
- def record(path):
611
- return path.startswith(RECORDS_DIR) and path.endswith('.md') and path != RECORDS_DIR + 'README.md'
612
-
613
-
614
- def tracked(path):
615
- return bool(CODE_PATHS.search(path) or PROTECTED_PATHS.search(path))
616
-
617
-
618
- def index_text(path):
619
- return git('show', ':' + path).decode('utf-8', 'replace')
620
-
621
-
622
- def commit_text(commit, path):
623
- return git('show', f'{commit}:{path}').decode('utf-8', 'replace')
624
-
625
-
626
- def switch_on(content):
627
- matches = re.findall(r'^\*\*CHANGE RECORDS:\s*(ON|OFF)\*\*\s*$', content, re.M | re.I)
628
- if len(matches) != 1:
629
- raise ValueError('AGENTS.md must have exactly one CHANGE RECORDS: ON/OFF switch')
630
- return matches[0].upper() == 'ON'
631
-
632
-
633
- def validate_record(path, content, changed):
634
- errors = []
635
- m = RECORD_NAME.fullmatch(path.split('/')[-1])
636
- if not m:
637
- return [f'{path}: invalid name (expected YYYY-MM-DD_HHMM_topic.md)'], set()
638
- date, hm = m.groups()
639
- try:
640
- dt.datetime.strptime(date + hm, '%Y-%m-%d%H%M')
641
- except ValueError:
642
- errors.append(f'{path}: impossible date/time')
643
- def field(name):
644
- match = re.search(r'^- \*\*' + re.escape(name) + r':\*\*\s*(.+?)\s*$', content, re.M)
645
- value = match.group(1).strip() if match else ''
646
- if not value or '<' in value or value in {'None | ...', 'TBD'}:
647
- errors.append(f'{path}: missing/unfilled {name}')
648
- return value
649
- if field('Date') != f'{date} {hm[:2]}:{hm[2:]} (Philippine time)':
650
- errors.append(f'{path}: Date does not match filename (Philippine time)')
651
- field('AI tool')
652
- field('Approved by (device owner)')
653
- field('Approval evidence')
654
- if field('Type') not in VALID_TYPES:
655
- errors.append(f'{path}: unsupported Type')
656
- field('Migration')
657
- section = re.search(r'^## Files changed\s*$\n(.*?)(?=^## |\Z)', content, re.M | re.S)
658
- listed = set()
659
- if section:
660
- for line in section.group(1).splitlines():
661
- if not line.strip():
662
- continue
663
- match = re.fullmatch(r'\s*- `([^`]+)`\s*', line)
664
- if not match:
665
- errors.append(f'{path}: invalid Files changed entry: {line.strip()}')
666
- else:
667
- listed.add(match.group(1))
668
- if not listed:
669
- errors.append(f'{path}: no files listed in ## Files changed')
670
- if listed - changed:
671
- errors.append(f'{path}: files not changed in this commit: {sorted(listed - changed)}')
672
- for heading in ('What changed and why', 'How to verify'):
673
- s = re.search(r'^## ' + re.escape(heading) + r'\s*$\n(.*?)(?=^## |\Z)', content, re.M | re.S)
674
- if not s or not s.group(1).strip() or '<' in s.group(1):
675
- errors.append(f'{path}: missing/unfilled ## {heading}')
676
- return errors, listed
677
-
678
-
679
- def check_change(label, changed_paths, added_records, content_reader, agent_text):
680
- print(f'Checking {label}')
681
- if not switch_on(agent_text):
682
- print(' Change records OFF: enforcement intentionally disabled.')
683
- return 0
684
- changed = set(changed_paths)
685
- altered_records = sorted(p for p in changed if record(p) and p not in added_records)
686
- errors = [f'Existing change record edited/deleted: {p}' for p in altered_records]
687
- coverage = set()
688
- for path in sorted(added_records):
689
- problems, listed = validate_record(path, content_reader(path), changed)
690
- errors += problems
691
- coverage |= listed
692
- missing = sorted(p for p in changed if tracked(p) and p not in coverage)
693
- if missing:
694
- errors.append('Missing NEW change-record coverage in this commit for: ' + ', '.join(missing))
695
- if errors:
696
- for err in errors:
697
- print(' ERROR: ' + err)
698
- return 1
699
- print(f' Passed: {sum(tracked(p) for p in changed)} tracked path(s), {len(added_records)} new record(s).')
700
- return 0
701
-
702
-
703
- def diff_paths(*args):
704
- return paths('diff', *args, '--name-only', '-z', '--no-renames')
705
-
706
-
707
- def staged():
708
- changed = diff_paths('--cached')
709
- added = set(diff_paths('--cached', '--diff-filter=A'))
710
- agent = index_text('AGENTS.md')
711
- return check_change('staged files', changed, {p for p in added if record(p)}, index_text, agent)
712
-
713
-
714
- def history():
715
- if BASELINE.startswith('<'):
716
- raise ValueError('Set BASELINE to an existing commit before using --history')
717
- baseline = git('rev-parse', '--verify', BASELINE + '^{commit}').decode().strip()
718
- head = git('rev-parse', '--verify', 'HEAD').decode().strip()
719
- check = subprocess.run(['git', 'merge-base', '--is-ancestor', baseline, head])
720
- if check.returncode:
721
- raise ValueError('BASELINE must be an ancestor of HEAD; rebaseline only with approval')
722
- commits = git('rev-list', '--first-parent', '--reverse', f'{baseline}..HEAD').decode().splitlines()
723
- failures = 0
724
- for commit in commits:
725
- parent = git('rev-parse', commit + '^1').decode().strip()
726
- changed = diff_paths(parent, commit)
727
- added = set(diff_paths('--diff-filter=A', parent, commit))
728
- failures += check_change('commit ' + commit[:12], changed, {p for p in added if record(p)},
729
- lambda p: commit_text(commit, p), commit_text(commit, 'AGENTS.md'))
730
- if not commits:
731
- print('No commits after audit baseline.')
732
- return int(failures > 0)
733
-
734
-
735
- def working():
736
- unstaged = diff_paths()
737
- untracked = paths('ls-files', '--others', '--exclude-standard', '-z')
738
- outstanding = sorted(p for p in set(unstaged + untracked) if tracked(p))
739
- if outstanding:
740
- print('Unstaged/untracked work (cannot be commit-audited until staged):')
741
- for p in outstanding:
742
- print(' - ' + p)
743
- return 1
744
- print('No unstaged/untracked tracked paths.')
745
- return 0
746
-
747
-
748
- def main():
749
- parser = argparse.ArgumentParser(description=__doc__)
750
- parser.add_argument('--staged', action='store_true', help='Validate staged code against newly staged records')
751
- parser.add_argument('--history', action='store_true', help='Validate each commit after BASELINE')
752
- parser.add_argument('--working', action='store_true', help='Report unaudited unstaged and untracked work')
753
- args = parser.parse_args()
754
- try:
755
- git('rev-parse', '--show-toplevel')
756
- if not (args.staged or args.history or args.working):
757
- args.staged = args.history = True
758
- return int(bool((staged() if args.staged else 0) |
759
- (history() if args.history else 0) |
760
- (working() if args.working else 0)))
761
- except (RuntimeError, ValueError, OSError) as e:
762
- print(f'Audit FAILED (not skipped): {e}', file=sys.stderr)
763
- return 2
764
-
765
-
766
- if __name__ == '__main__':
767
- sys.exit(main())
768
- ```
769
-
770
- **Node.js 18+** — `scripts/freezeAudit.cjs`. CommonJS avoids depending on `package.json` `type`:
771
-
772
- ```javascript
773
- // Agent Docs Kit — commit-scoped change-record audit.
774
- // Created by ghostbyte1014 · Agent Docs Kit
775
- // Node.js 18+, CommonJS (works with either package.json module type).
776
- 'use strict';
777
- const { spawnSync } = require('node:child_process');
778
-
779
- const BASELINE = '<BASELINE COMMIT>'; // Set at installation. Only --history needs it.
780
- const RECORDS_DIR = 'docs/05-operations/agents/feature-updates/';
781
- const CODE_PATHS = /^(src\/|app\/|lib\/|scripts\/|migrations\/|supabase\/|package\.json$|pyproject\.toml$|requirements\.txt$)/; // ADAPT
782
- const PROTECTED_PATHS = /^(AGENTS\.md$|CLAUDE\.md$|GEMINI\.md$|\.githooks\/|\.claude\/settings(?:\.off)?\.json$)/;
783
- const RECORD_NAME = /^(\d{4}-\d{2}-\d{2})_(\d{4})(?:-\d{2})?_[a-z0-9][a-z0-9-]*\.md$/;
784
- const TYPES = new Set(['Fix', 'Polish', 'Feature', 'New feature (approved outside the documented flow)']);
785
-
786
- function git(...args) {
787
- const result = spawnSync('git', args, { encoding: 'buffer' });
788
- if (result.error || result.status !== 0) {
789
- throw Error(`git ${args.join(' ')} failed: ${result.error?.message || result.stderr?.toString('utf8').trim()}`);
790
- }
791
- return result.stdout;
792
- }
793
- function paths(...args) { return git(...args).toString('utf8').split('\0').filter(Boolean); }
794
- function record(path) { return path.startsWith(RECORDS_DIR) && path.endsWith('.md') && path !== RECORDS_DIR + 'README.md'; }
795
- function tracked(path) { return CODE_PATHS.test(path) || PROTECTED_PATHS.test(path); }
796
- function indexText(path) { return git('show', `:${path}`).toString('utf8'); }
797
- function commitText(commit, path) { return git('show', `${commit}:${path}`).toString('utf8'); }
798
- function switchOn(content) {
799
- const matches = [...content.matchAll(/^\*\*CHANGE RECORDS:\s*(ON|OFF)\*\*\s*$/gim)];
800
- if (matches.length !== 1) throw Error('AGENTS.md must have exactly one CHANGE RECORDS: ON/OFF switch');
801
- return matches[0][1].toUpperCase() === 'ON';
802
- }
803
- function field(content, path, name, errors) {
804
- const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
805
- const match = content.match(new RegExp(`^- \\*\\*${escaped}:\\*\\*\\s*(.+?)\\s*$`, 'm'));
806
- const value = match?.[1]?.trim() || '';
807
- if (!value || value.includes('<') || value === 'TBD') errors.push(`${path}: missing/unfilled ${name}`);
808
- return value;
809
- }
810
- function section(content, heading) {
811
- const escaped = heading.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
812
- const match = content.match(new RegExp(`^## ${escaped}\\s*\\n([\\s\\S]*?)(?=^## |$(?![\\s\\S]))`, 'm'));
813
- return match?.[1] || '';
814
- }
815
- function validateRecord(path, content, changed) {
816
- const errors = [];
817
- const file = path.split('/').at(-1);
818
- const m = file.match(RECORD_NAME);
819
- if (!m) return { errors: [`${path}: invalid name (expected YYYY-MM-DD_HHMM_topic.md)`], listed: new Set() };
820
- const [, date, hm] = m;
821
- const iso = `${date}T${hm.slice(0, 2)}:${hm.slice(2)}:00Z`;
822
- const parsed = new Date(iso);
823
- if (Number.isNaN(parsed.valueOf()) || parsed.toISOString().slice(0, 16) !== iso.slice(0, 16)) errors.push(`${path}: impossible date/time`);
824
- if (field(content, path, 'Date', errors) !== `${date} ${hm.slice(0, 2)}:${hm.slice(2)} (Philippine time)`)
825
- errors.push(`${path}: Date does not match filename (Philippine time)`);
826
- field(content, path, 'AI tool', errors);
827
- field(content, path, 'Approved by (device owner)', errors);
828
- field(content, path, 'Approval evidence', errors);
829
- if (!TYPES.has(field(content, path, 'Type', errors))) errors.push(`${path}: unsupported Type`);
830
- field(content, path, 'Migration', errors);
831
- const listed = new Set();
832
- const files = section(content, 'Files changed');
833
- for (const line of files.split('\n').filter(x => x.trim())) {
834
- const match = line.match(/^\s*- `([^`]+)`\s*$/);
835
- if (!match) errors.push(`${path}: invalid Files changed entry: ${line.trim()}`);
836
- else listed.add(match[1]);
837
- }
838
- if (!listed.size) errors.push(`${path}: no files listed in ## Files changed`);
839
- const extra = [...listed].filter(p => !changed.has(p));
840
- if (extra.length) errors.push(`${path}: files not changed in this commit: ${extra.join(', ')}`);
841
- for (const heading of ['What changed and why', 'How to verify']) {
842
- const body = section(content, heading).trim();
843
- if (!body || body.includes('<')) errors.push(`${path}: missing/unfilled ## ${heading}`);
844
- }
845
- return { errors, listed };
846
- }
847
- function checkChange(label, changedFiles, addedRecords, readText, agents) {
848
- console.log(`Checking ${label}`);
849
- if (!switchOn(agents)) { console.log(' Change records OFF: enforcement intentionally disabled.'); return 0; }
850
- const changed = new Set(changedFiles);
851
- const errors = [...changed].filter(p => record(p) && !addedRecords.has(p)).map(p => `Existing change record edited/deleted: ${p}`);
852
- const covered = new Set();
853
- for (const path of [...addedRecords].sort()) {
854
- const result = validateRecord(path, readText(path), changed);
855
- errors.push(...result.errors);
856
- for (const p of result.listed) covered.add(p);
857
- }
858
- const missing = [...changed].filter(p => tracked(p) && !covered.has(p)).sort();
859
- if (missing.length) errors.push('Missing NEW change-record coverage in this commit for: ' + missing.join(', '));
860
- if (errors.length) { for (const error of errors) console.error(' ERROR: ' + error); return 1; }
861
- console.log(` Passed: ${[...changed].filter(tracked).length} tracked path(s), ${addedRecords.size} new record(s).`);
862
- return 0;
863
- }
864
- function diffPaths(...args) { return paths('diff', ...args, '--name-only', '-z', '--no-renames'); }
865
- function staged() {
866
- const changed = diffPaths('--cached');
867
- const added = new Set(diffPaths('--cached', '--diff-filter=A').filter(record));
868
- return checkChange('staged files', changed, added, indexText, indexText('AGENTS.md'));
869
- }
870
- function history() {
871
- if (BASELINE.startsWith('<')) throw Error('Set BASELINE to an existing commit before using --history');
872
- const baseline = git('rev-parse', '--verify', `${BASELINE}^{commit}`).toString('utf8').trim();
873
- const head = git('rev-parse', '--verify', 'HEAD').toString('utf8').trim();
874
- const ancestry = spawnSync('git', ['merge-base', '--is-ancestor', baseline, head]);
875
- if (ancestry.error || ancestry.status !== 0) throw Error('BASELINE must be an ancestor of HEAD; rebaseline only with approval');
876
- const commits = git('rev-list', '--first-parent', '--reverse', `${baseline}..HEAD`).toString('utf8').split('\n').filter(Boolean);
877
- let failures = 0;
878
- for (const commit of commits) {
879
- const parent = git('rev-parse', `${commit}^1`).toString('utf8').trim();
880
- const changed = diffPaths(parent, commit);
881
- const added = new Set(diffPaths('--diff-filter=A', parent, commit).filter(record));
882
- failures += checkChange('commit ' + commit.slice(0, 12), changed, added, path => commitText(commit, path), commitText(commit, 'AGENTS.md'));
883
- }
884
- if (!commits.length) console.log('No commits after audit baseline.');
885
- return Number(failures > 0);
886
- }
887
- function working() {
888
- const pending = new Set([...diffPaths(), ...paths('ls-files', '--others', '--exclude-standard', '-z')].filter(tracked));
889
- if (pending.size) {
890
- console.log('Unstaged/untracked work (cannot be commit-audited until staged):');
891
- for (const path of [...pending].sort()) console.log(' - ' + path);
892
- return 1;
893
- }
894
- console.log('No unstaged/untracked tracked paths.');
895
- return 0;
896
- }
897
- function main() {
898
- try {
899
- git('rev-parse', '--show-toplevel');
900
- const args = process.argv.slice(2);
901
- if (args.some(a => !['--staged', '--history', '--working'].includes(a))) throw Error('Unknown option; use --staged, --history, or --working');
902
- const defaults = args.length === 0;
903
- let failures = 0;
904
- if (defaults || args.includes('--staged')) failures |= staged();
905
- if (defaults || args.includes('--history')) failures |= history();
906
- if (args.includes('--working')) failures |= working();
907
- process.exitCode = Number(failures > 0);
908
- } catch (e) { console.error(`Audit FAILED (not skipped): ${e.message}`); process.exitCode = 2; }
909
- }
910
- main();
911
- ```
912
-
913
- **Run:**
914
-
915
- ```bash
916
- python3 scripts/freeze_audit.py --staged # or: node scripts/freezeAudit.cjs --staged
917
- python3 scripts/freeze_audit.py --history # historical audit since BASELINE
918
- python3 scripts/freeze_audit.py --working # optional unstaged/untracked diagnostic
919
- ```
920
-
921
- On Windows, use `python` or `py -3` only if that command is confirmed to resolve to Python 3.9+. For Node projects, an optional package script may call `node scripts/freezeAudit.cjs`; do not alter an existing package script without approval.
922
-
923
- ### C3. Commit check (pre-commit hook)
924
-
925
- Use the exact runtime installed in C2. Create `.githooks/pre-commit` with LF line endings and make it executable in Git. If the repository already uses Husky, lefthook, or another hook manager, integrate the same `--staged` command there instead of overwriting its existing hook.
926
-
927
- **Python version** (adapt `python3` to a confirmed interpreter for the developer's OS):
928
-
929
- ```sh
930
- #!/bin/sh
931
- # Staged change-record check. Created by ghostbyte1014 · Agent Docs Kit
932
- # Fail closed if Python is unavailable. All failures block the commit.
933
- if ! command -v python3 >/dev/null 2>&1; then
934
- echo "Commit blocked: Python 3 is needed for change-record verification." >&2
935
- exit 1
936
- fi
937
- python3 scripts/freeze_audit.py --staged || {
938
- echo "Commit blocked: stage a NEW valid change record with this code change." >&2
939
- exit 1
940
- }
941
- ```
942
-
943
- **Node version** (use instead of Python if C2 installed Node):
944
-
945
- ```sh
946
- #!/bin/sh
947
- # Staged change-record check. Created by ghostbyte1014 · Agent Docs Kit
948
- if ! command -v node >/dev/null 2>&1; then
949
- echo "Commit blocked: Node.js is needed for change-record verification." >&2
950
- exit 1
951
- fi
952
- node scripts/freezeAudit.cjs --staged || {
953
- echo "Commit blocked: stage a NEW valid change record with this code change." >&2
954
- exit 1
955
- }
956
- ```
957
-
958
- **Activation** (only after developer approval):
959
-
960
- ```bash
961
- git update-index --chmod=+x .githooks/pre-commit
962
- git config core.hooksPath .githooks
963
- git config --get core.hooksPath
964
- ```
965
-
966
- A developer may instead choose an npm `prepare` script or a setup script to activate the hook, but must explicitly approve that automation. Do not silently replace an existing `prepare` script or hook. The hook rejects missing runtime, malformed records, and Git errors; it cannot prevent `git commit --no-verify`. For centralized protection, optionally configure CI to run the selected audit with `--history` on the protected branch, using a valid baseline and a checkout with commit history.
967
-
968
- ## Part D. First change record (Step 5)
969
-
970
- ~~~~markdown
971
- # Agent docs kit setup
972
-
973
- - **Date:** YYYY-MM-DD HH:MM (Philippine time)
974
- - **AI tool:** <actual tool and model>
975
- - **Approved by (device owner):** <git user.name> (<git user.email>)
976
- - **Approval evidence:** <Exact approval to install the listed files>
977
- - **Type:** Feature
978
- - **Migration:** None
979
-
980
- ## Files changed
981
- - `AGENTS.md`
982
- - `CLAUDE.md`
983
- - `GEMINI.md`
984
- - `docs/README.md`
985
- - `docs/archive/README.md`
986
- - `docs/05-operations/agents/CHANGE_FREEZE_GUIDE.md`
987
- - `docs/05-operations/agents/feature-updates/README.md`
988
- - `docs/01-system/overview/SYSTEM_SCOPE.md` (only if created; remove this note in the actual record)
989
- - <add every actual add-on file created or existing file modified; remove this template note>
990
-
991
- ## What changed and why
992
- Installed the Agent Docs Kit v3.2 compiled edition (including Session Gate), including two separate mandatory startup questions, the documentation index, the new-record-per-change workflow, and optional commit-scoped audit (ON for records, OFF for freeze). The developer approved the listed setup files. Optional add-ons installed: <C1/C2/C3 or none>.
993
-
994
- ## How to verify
995
- - Inspect `AGENTS.md` and the documentation index; check that scope status is truthful. In a new coding chat, verify the agent asks Change Freeze and then, in a separate message, Change Records; until both are answered, verify it does not modify files.
996
- - If C2 installed: with the setup record staged, `<AUDIT COMMAND> --staged` passes; `<AUDIT COMMAND> --history` verifies post-baseline commits.
997
- - If C3 installed: `git config --get core.hooksPath` prints `.githooks`, and an unrecorded staged code change causes the hook to reject a test commit (without pushing).
998
- ~~~~
999
-
1000
- ---
1001
-
1002
- ## Part E. Validation checklist for kit maintainers
1003
-
1004
- These tests are required before declaring a **new adaptation** of C2/C3 reliable. Run them only in a temporary disposable Git repository; never intentionally insert failures into a production branch.
1005
-
1006
- | Test | Expected result |
1007
- |---|---|
1008
- | Staged code modification, no newly staged record | **Fail** |
1009
- | Valid new record staged with code | Pass |
1010
- | An older committed record mentions the same file, but a new edit has no new record | **Fail** |
1011
- | Record file exists in working tree but has not been staged | **Fail** |
1012
- | Existing committed record is edited or deleted | **Fail** |
1013
- | Newly staged record lists a file not changed in the same commit | **Fail** |
1014
- | A tracked file is deleted or renamed without record coverage | **Fail** |
1015
- | Record missing required fields, with invalid filename/date/type | **Fail** |
1016
- | One post-baseline commit bypasses the hook, then history audit runs | **Fail** |
1017
- | C2 runtime unavailable and C3 installed | **Fail closed** |
1018
- | `CHANGE RECORDS: OFF` is deliberately set in staged `AGENTS.md` | Coverage check intentionally skipped; document the bypass |
1019
- | Only an ordinary documentation file changes | Pass without record |
1020
- | New coding chat/session loads rules | Asks Change Freeze first, then Change Records in a separate turn; no mutation before both replies |
1021
- | Both startup answers are Keep current setting | No switch-file changes; follow persisted rules |
1022
- | Startup choice differs from persisted switch and no edit approval | Stay read-only; clearly report mismatch |
1023
- | Change Records switched OFF with a new governance record | Required by policy, but **not enforced by C2** when the staged switch is OFF |
1024
-
1025
- **Known limits:** The checks ensure per-commit *record coverage* and metadata format, not feature correctness, truthful timestamps, source-of-truth agreement, or genuine human authorization. The Session Gate is instructional unless supplemented by an external startup guard, and C2 intentionally permits disabling coverage through the staged `CHANGE RECORDS: OFF` switch. Local hooks can be bypassed; CI can be skipped if not required by branch protection; an administrator can disable `CHANGE RECORDS`. Merge and squash behavior should be verified on the team's real Git workflow. Protect the audit implementation, `AGENTS.md`, branch, and CI settings accordingly.