@ryuenn3123/agentic-senior-core 3.0.46 → 3.0.47

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.
@@ -26,12 +26,14 @@ If the user describes a project or feature, the agent must:
26
26
  If the user asks to create, complete, fix, or review project docs, documentation, dokumen, `docs/*`, architecture docs, flow docs, API docs, or "lengkapkan docs", treat the request as documentation-first.
27
27
 
28
28
  The agent must:
29
- 1. Materialize or refine required project docs before implementation: root `README.md` for every fresh or existing project; `docs/project-brief.md`; `docs/architecture-decision-record.md`; `docs/flow-overview.md`; `docs/api-contract.md` when APIs, firmware endpoints, CLI commands, or web application flows exist; `docs/database-schema.md` when persistent data exists; and `docs/DESIGN.md` plus `docs/design-intent.json` for UI scope.
29
+ 1. Materialize or refine required project docs before implementation: root `README.md` for every fresh or existing project; `docs/doc-index.md` whenever `docs/` exists; `docs/project-brief.md`; `docs/architecture-decision-record.md`; `docs/flow-overview.md`; `docs/api-contract.md` when APIs, firmware endpoints, CLI commands, or web application flows exist; `docs/database-schema.md` when persistent data exists; and `docs/DESIGN.md` plus `docs/design-intent.json` for UI scope.
30
30
  2. Write formal project docs in English by default unless the user explicitly asks for another documentation language.
31
- 3. Keep `README.md` public and developer friendly even for private projects: explain what the project is, who it is for, how to set it up, how to run the core workflow, how to configure it, and where deeper docs live. Do not put internal agent notes, private reasoning, secrets, or governance policy in the README.
32
- 4. Keep documentation alive. When project behavior, setup, architecture, public contracts, data shape, deployment, or UI scope changes, update the matching docs in the same change.
33
- 5. Avoid documentation sprawl. Add a new docs file only when the topic is stable, long enough to outgrow the README or core docs, or owned by a separate workflow such as hardware setup, deployment, troubleshooting, or testing validation.
34
- 6. Stop after docs when the user only asked for docs. Do not write application, firmware, or UI code until the user explicitly asks for implementation or approves the implementation plan.
31
+ 3. Keep `docs/doc-index.md` short. Use it as the read-routing map with document path, purpose, reads-when triggers, status, and last-updated date. Do not duplicate the docs it points to.
32
+ 4. Keep `README.md` public and developer friendly even for private projects: explain what the project is, who it is for, how to set it up, how to run the core workflow, how to configure it, and where deeper docs live. Do not put internal agent notes, private reasoning, secrets, or governance policy in the README.
33
+ 5. Keep documentation alive. When project behavior, setup, architecture, public contracts, data shape, deployment, or UI scope changes, update the matching docs in the same change.
34
+ 6. Avoid documentation sprawl. Add a new docs file only when the topic is stable, long enough to outgrow the README or core docs, or owned by a separate workflow such as hardware setup, deployment, troubleshooting, or testing validation.
35
+ 7. Add PRD, SRS, technical-design, or separate ERD only when evidence triggers them. Use PRD for product roadmap/user-story ownership, SRS for contractual or multi-stakeholder acceptance criteria, technical-design for non-trivial architecture decisions, and a separate ERD only when `docs/database-schema.md` cannot stay readable with an embedded diagram.
36
+ 8. Stop after docs when the user only asked for docs. Do not write application, firmware, or UI code until the user explicitly asks for implementation or approves the implementation plan.
35
37
 
36
38
  ## Direct Constraint Mode
37
39
 
@@ -11,7 +11,7 @@ Before editing:
11
11
  3. If required project docs are missing, stop and bootstrap or update docs first.
12
12
  4. If the change touches UI, load .agent-context/prompts/bootstrap-design.md and .agent-context/rules/frontend-architecture.md before editing.
13
13
  5. If the change touches a dependency, framework, Docker, runtime, or ecosystem claim, verify current official docs before choosing.
14
- 6. Enforce Universal SOP hard gate: stop implementation if root `README.md` is missing, if `docs/architecture-decision-record.md` is missing, or for UI scope if `docs/DESIGN.md` or `docs/design-intent.json` is missing.
14
+ 6. Enforce Universal SOP hard gate: stop implementation if root `README.md` is missing, if `docs/doc-index.md` is missing while `docs/` exists, if `docs/architecture-decision-record.md` is missing, or for UI scope if `docs/DESIGN.md` or `docs/design-intent.json` is missing.
15
15
  7. Enforce backend universal principles: no clever hacks, no premature abstraction, readability over brevity.
16
16
  8. For backend/API scope, enforce layered boundaries, zero-trust input validation, safe centralized error responses, bounded list reads, transaction safety for multi-write mutations, idempotency for sensitive mutations, and behavior-focused API tests.
17
17
  9. Backend/API governance is global and stack-agnostic. Do not create stack-specific adapters or framework-specific rule branches; apply the global rules through the framework already present in the target project.
@@ -11,7 +11,7 @@ Before reviewing:
11
11
  3. Read .agent-context/review-checklists/architecture-review.md only when architecture or boundaries changed.
12
12
  4. Load only the rules relevant to the changed scope.
13
13
  5. For UI changes, load .agent-context/prompts/bootstrap-design.md, .agent-context/rules/frontend-architecture.md, docs/DESIGN.md, and docs/design-intent.json when present.
14
- 6. Enforce Universal SOP hard gate: block coding flow when required project docs are missing (root `README.md`; `docs/architecture-decision-record.md`; and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).
14
+ 6. Enforce Universal SOP hard gate: block coding flow when required project docs are missing (root `README.md`; `docs/doc-index.md` when `docs/` exists; `docs/architecture-decision-record.md`; and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).
15
15
  7. Enforce single-source and lazy-loading policy: canonical rule source must be explicitly enforced, global domain governance must load lazily based on touched scope, and conflicting duplicate rule instructions must not appear during normal flow.
16
16
 
17
17
  Prioritize findings in this order:
@@ -61,6 +61,7 @@ Run this before declaring a task done. Apply only the sections relevant to the c
61
61
  - [ ] Scope applied: This applies to documentation, release notes, onboarding text, review summaries, and agent-facing explanations
62
62
  - [ ] Style scope review is advisory and does not block merge when API docs are synced in the same commit and contract details are correct
63
63
  - [ ] Required docs exist before implementation: public and developer root README; project brief; architecture decision; flow overview; API/public contract when relevant; data model when relevant; and UI design contract when relevant.
64
+ - [ ] `docs/doc-index.md` exists whenever `docs/` exists and acts as a compact read-routing map instead of duplicating requirements or architecture.
64
65
  - [ ] For docs-only or docs-first requests, implementation code was not changed unless the user explicitly asked for it or approved an implementation plan.
65
66
  - [ ] Formal project docs use English by default unless the user requested another language or existing docs established one.
66
67
  - [ ] Docs cover feature plan, architecture rationale, public contracts, data model, UI/design, security assumptions, testing strategy, delivery flow, and next validation actions where relevant.
@@ -73,6 +74,7 @@ Run this before declaring a task done. Apply only the sections relevant to the c
73
74
  - [ ] Root README is public and developer friendly, even for private projects, and does not contain secrets, internal agent notes, private reasoning, or governance policy dumps.
74
75
  - [ ] Documentation grows with the project: README and matching docs were updated when setup, runtime, architecture, public contracts, data shape, deployment, validation, or UI scope changed.
75
76
  - [ ] Documentation file count stayed intentional: new docs files were added only for stable, distinct, or long workflows.
77
+ - [ ] PRD, SRS, technical-design, or separate ERD files were added only when project evidence justified a distinct document.
76
78
 
77
79
  ## 7. UI And Accessibility
78
80
 
@@ -120,6 +122,7 @@ Run this before declaring a task done. Apply only the sections relevant to the c
120
122
  - [ ] Security and testing requirements remain mandatory after static template purge.
121
123
  - [ ] Coding flow is blocked if `docs/architecture-decision-record.md` (or `docs/Architecture-Decision-Record.md`) is missing
122
124
  - [ ] Coding flow is blocked if root `README.md` is missing
125
+ - [ ] Coding flow is blocked if `docs/doc-index.md` is missing while `docs/` exists
123
126
  - [ ] UI implementation flow is blocked if `docs/DESIGN.md` or `docs/design-intent.json` is missing
124
127
 
125
128
  ## Verdict
@@ -18,8 +18,12 @@ Choose README sections from project evidence. Do not force a fixed template when
18
18
 
19
19
  Documentation must evolve with the project. When behavior, setup, architecture, public contracts, data shape, deployment, or validation changes, update README and the matching docs in the same change.
20
20
 
21
+ When `docs/` exists, keep `docs/doc-index.md` as the compact routing map for humans and agents. It should list active docs, their purpose, read triggers, status, and last update. It must not duplicate requirements, architecture, or API contracts.
22
+
21
23
  Start compact, then split only when a topic earns its own file. Good split signals are: the section is long, the workflow is owned separately, the content is referenced often, or the topic needs step-by-step care such as hardware setup, deployment, testing validation, operations, or troubleshooting.
22
24
 
25
+ Use PRD, SRS, technical design, and ERD as conditional docs, not default boilerplate. PRD covers product intent and roadmap ownership. SRS covers contractual or complex acceptance criteria. Technical design covers architecture under pressure. ERD stays inside `docs/database-schema.md` unless the data model is large or relationship-heavy.
26
+
23
27
  ## Contract Rules
24
28
 
25
29
  - Document the public surface before or alongside implementation.
@@ -33,6 +33,7 @@ The `.agent-context/rules/` directory is the default guidance source for impleme
33
33
  - Security and testing are non-negotiable baseline requirements.
34
34
  - Hard block before coding:
35
35
  - Root `README.md` must exist for every fresh or existing project and read as a public and developer entrypoint, not an internal agent note.
36
+ - `docs/doc-index.md` must exist whenever `docs/` exists. It is a compact read-routing map, not a replacement for project docs.
36
37
  - `docs/project-brief.md` must exist.
37
38
  - `docs/architecture-decision-record.md` (alias: `docs/Architecture-Decision-Record.md`) must exist.
38
39
  - `docs/flow-overview.md` must exist.
@@ -47,6 +48,19 @@ The `.agent-context/rules/` directory is the default guidance source for impleme
47
48
  - Keep docs current with project changes. Update README and the matching docs whenever setup, runtime, architecture, public contracts, data shape, UI scope, deployment, or validation flow changes.
48
49
  - Control docs file count. Keep the baseline compact, then add topic files only when a subject is stable, too long for README/core docs, or belongs to a distinct workflow such as hardware setup, deployment, testing validation, operations, or troubleshooting.
49
50
 
51
+ ## Documentation Read Routing and Conditional Specs
52
+
53
+ Use `README.md` for human orientation, then use `docs/doc-index.md` to choose the smallest relevant read set. Do not broad-read every Markdown file in `docs/` by default.
54
+
55
+ - Read `docs/project-brief.md`, `docs/architecture-decision-record.md`, and `docs/flow-overview.md` for broad planning, new features, or architecture changes.
56
+ - Read `docs/api-contract.md` only when API, CLI, firmware endpoint, web flow, event, or library contract behavior is in scope.
57
+ - Read `docs/database-schema.md` only when persistence, migrations, data shape, or query behavior is in scope.
58
+ - Read `docs/DESIGN.md` and `docs/design-intent.json` only for UI, UX, frontend, layout, component, or visual work.
59
+ - Add `docs/prd.md` only when there is product-roadmap, user-story, metrics, product-owner, or feature-flag ownership that would otherwise bloat the project brief.
60
+ - Add `docs/srs.md` only for contractual, regulated, multi-stakeholder, or acceptance-criteria-heavy projects. Do not create both PRD and SRS unless those owners and purposes are distinct.
61
+ - Add `docs/technical-design.md` only for non-trivial architecture decisions, major refactors, cross-cutting behavior, or system interactions that outgrow the ADR and flow overview.
62
+ - Keep ERD inside `docs/database-schema.md` for small and medium schemas. Add a separate ERD file only when relationship complexity makes the schema doc hard to scan.
63
+
50
64
  ## Rules as Guardian (Cross-Session Consistency)
51
65
 
52
66
  - Session handoff must include active architecture contract summary.
@@ -7,7 +7,7 @@ alwaysApply: true
7
7
 
8
8
  Adapter Mode: thin
9
9
  Adapter Source: .instructions.md
10
- Canonical Snapshot SHA256: c66b5dfe48a25f0df297a1681aa6bab572da95d2201f09abf3767d38a2934591
10
+ Canonical Snapshot SHA256: 728c7ecaa49ea69a3e9b03c1c88d25f310a1827f2cebb72de102b5ae5005ff0e
11
11
 
12
12
  This repository is governed by a strict instruction contract.
13
13
  Use [.instructions.md](../../.instructions.md) as the canonical policy source.
package/.cursorrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # .cursorrules - Legacy Thin Adapter
2
2
 
3
- Generated by Agentic-Senior-Core CLI v3.0.46
3
+ Generated by Agentic-Senior-Core CLI v3.0.47
4
4
  Adapter Mode: legacy-thin
5
5
  Adapter Source: .agent-instructions.md when present; fallback .instructions.md
6
6
  Canonical baseline: .instructions.md
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: c66b5dfe48a25f0df297a1681aa6bab572da95d2201f09abf3767d38a2934591
5
+ Canonical Snapshot SHA256: 728c7ecaa49ea69a3e9b03c1c88d25f310a1827f2cebb72de102b5ae5005ff0e
6
6
 
7
7
  This repository is governed by a strict instruction contract.
8
8
  Use [.instructions.md](../.instructions.md) as the canonical policy source.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: c66b5dfe48a25f0df297a1681aa6bab572da95d2201f09abf3767d38a2934591
5
+ Canonical Snapshot SHA256: 728c7ecaa49ea69a3e9b03c1c88d25f310a1827f2cebb72de102b5ae5005ff0e
6
6
 
7
7
  This repository is governed by a strict instruction contract.
8
8
  Use [.instructions.md](../.instructions.md) as the canonical policy source.
@@ -6,7 +6,7 @@ applyTo: "**"
6
6
 
7
7
  Adapter Mode: thin
8
8
  Adapter Source: .instructions.md
9
- Canonical Snapshot SHA256: c66b5dfe48a25f0df297a1681aa6bab572da95d2201f09abf3767d38a2934591
9
+ Canonical Snapshot SHA256: 728c7ecaa49ea69a3e9b03c1c88d25f310a1827f2cebb72de102b5ae5005ff0e
10
10
 
11
11
  This repository is governed by a strict instruction contract.
12
12
  Use [.instructions.md](../../.instructions.md) as the canonical policy source.
package/.instructions.md CHANGED
@@ -97,7 +97,7 @@ Use `.agent-context/policies/` for quality gates, release thresholds, and audit
97
97
 
98
98
  ### Layer 9: Project Context
99
99
 
100
- Use root `README.md` as the public and developer entrypoint for every fresh or existing project. Use `docs/` when present: `project-brief.md`, `architecture-decision-record.md`, `database-schema.md`, `api-contract.md`, `flow-overview.md`, `DESIGN.md`, `design-intent.json`.
100
+ Use root `README.md` as the public and developer entrypoint for every fresh or existing project. Use `docs/doc-index.md` as the compact routing map when `docs/` exists. Use `docs/` when present: `project-brief.md`, `architecture-decision-record.md`, `database-schema.md`, `api-contract.md`, `flow-overview.md`, `DESIGN.md`, `design-intent.json`.
101
101
 
102
102
  ## Mandatory Triggers
103
103
 
@@ -106,9 +106,10 @@ Use root `README.md` as the public and developer entrypoint for every fresh or e
106
106
  Trigger: docs, documentation, dokumen, `docs/*`, architecture docs, flow docs, API docs, or "lengkapkan docs".
107
107
 
108
108
  1. Load `architecture.md`, `api-docs.md`, and only additional rules required by scope.
109
- 2. Create or refine required docs first: root `README.md` for every fresh or existing project; `docs/project-brief.md`; `docs/architecture-decision-record.md`; `docs/flow-overview.md`; `docs/api-contract.md` for APIs, firmware endpoints, CLI commands, or web application flows; `docs/database-schema.md` for persistent data; and `docs/DESIGN.md` plus `docs/design-intent.json` for UI scope.
110
- 3. Write formal project docs in English by default unless the user asks otherwise.
111
- 4. Stop after documentation when the user only asked for docs. Do not write application, firmware, or UI code until the user asks or approves implementation.
109
+ 2. Create or refine required docs first: root `README.md` for every fresh or existing project; `docs/doc-index.md` whenever `docs/` exists; `docs/project-brief.md`; `docs/architecture-decision-record.md`; `docs/flow-overview.md`; `docs/api-contract.md` for APIs, firmware endpoints, CLI commands, or web application flows; `docs/database-schema.md` for persistent data; and `docs/DESIGN.md` plus `docs/design-intent.json` for UI scope.
110
+ 3. Use `docs/doc-index.md` as the compact read-routing map. Add PRD, SRS, technical-design, or separate ERD only when project evidence justifies them.
111
+ 4. Write formal project docs in English by default unless the user asks otherwise.
112
+ 5. Stop after documentation when the user only asked for docs. Do not write application, firmware, or UI code until the user asks or approves implementation.
112
113
 
113
114
  ### 2. New Project Planning
114
115
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: c66b5dfe48a25f0df297a1681aa6bab572da95d2201f09abf3767d38a2934591
5
+ Canonical Snapshot SHA256: 728c7ecaa49ea69a3e9b03c1c88d25f310a1827f2cebb72de102b5ae5005ff0e
6
6
 
7
7
  This repository is governed by a strict instruction contract.
8
8
  Use [.instructions.md](../../.instructions.md) as the canonical policy source.
package/.windsurfrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # .windsurfrules - Legacy Thin Adapter
2
2
 
3
- Generated by Agentic-Senior-Core CLI v3.0.46
3
+ Generated by Agentic-Senior-Core CLI v3.0.47
4
4
  Adapter Mode: legacy-thin
5
5
  Adapter Source: .agent-instructions.md when present; fallback .instructions.md
6
6
  Canonical baseline: .instructions.md
package/AGENTS.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: c66b5dfe48a25f0df297a1681aa6bab572da95d2201f09abf3767d38a2934591
5
+ Canonical Snapshot SHA256: 728c7ecaa49ea69a3e9b03c1c88d25f310a1827f2cebb72de102b5ae5005ff0e
6
6
 
7
7
  This repository is governed by a strict instruction contract.
8
8
  Use [.instructions.md](.instructions.md) as the canonical policy source.
package/CLAUDE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: c66b5dfe48a25f0df297a1681aa6bab572da95d2201f09abf3767d38a2934591
5
+ Canonical Snapshot SHA256: 728c7ecaa49ea69a3e9b03c1c88d25f310a1827f2cebb72de102b5ae5005ff0e
6
6
 
7
7
  This repository is governed by a strict instruction contract.
8
8
  Use [.instructions.md](.instructions.md) as the canonical policy source.
package/GEMINI.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: c66b5dfe48a25f0df297a1681aa6bab572da95d2201f09abf3767d38a2934591
5
+ Canonical Snapshot SHA256: 728c7ecaa49ea69a3e9b03c1c88d25f310a1827f2cebb72de102b5ae5005ff0e
6
6
 
7
7
  This repository is governed by a strict instruction contract.
8
8
  Use [.instructions.md](.instructions.md) as the canonical policy source.
package/README.md CHANGED
@@ -34,6 +34,8 @@ One command to initialize rules, checklists, thin discovery adapters, and a comp
34
34
  > **See [docs/deep-dive.md](docs/deep-dive.md) and [docs/roadmap.md](docs/roadmap.md) for advanced configuration, planning mode, snapshot, and realtime options.**
35
35
 
36
36
  - This command writes `.agent-context/state/v3-purge-audit.json` and reports whether static directory deletion is safe.
37
+ - When project docs are scaffolded, `docs/doc-index.md` is used as the compact map for deeper docs so agents can read the right files without scanning every Markdown file.
38
+ - Local backup snapshots are written under `.agentic-backup/`; init and upgrade ensure that folder is ignored by the target repository.
37
39
  - Package scope is `@ryuenn3123`; the GitHub repository owner is `fatidaprilian`.
38
40
 
39
41
  ---
@@ -95,6 +97,8 @@ Use `--dry-run` first to preview changes safely, then apply with `--yes`.
95
97
  Upgrade now performs managed-surface synchronization by default: obsolete governance files under managed paths are pruned so the pack stays aligned with the latest release.
96
98
  Use `--no-prune` if you want to keep legacy managed files.
97
99
 
100
+ When upgrade creates `.agentic-backup/`, it also keeps the target root `.gitignore` aligned with that local-only backup folder. The backup is for rollback safety, not a source of truth and not a file to commit.
101
+
98
102
  ## Instruction Entrypoints
99
103
 
100
104
  The canonical source is `.instructions.md`.
@@ -4,6 +4,9 @@ import crypto from 'node:crypto';
4
4
  import { pathExists, ensureDirectory } from './utils.mjs';
5
5
  import { entryPointFiles, BACKUP_DIR_NAME } from './constants.mjs';
6
6
 
7
+ const BACKUP_GITIGNORE_ENTRY = `${BACKUP_DIR_NAME}/`;
8
+ const BACKUP_GITIGNORE_COMMENT = '# agentic-senior-core: local backup artifacts';
9
+
7
10
  /**
8
11
  * Calculates a SHA-256 hash of a file's contents.
9
12
  */
@@ -54,6 +57,7 @@ export async function createBackup(targetDirectoryPath) {
54
57
  await ensureDirectory(objectsDir);
55
58
 
56
59
  const pathsToTrack = [
60
+ path.join(targetDirectoryPath, '.gitignore'),
57
61
  ...entryPointFiles.map((entryPointFileName) => path.join(targetDirectoryPath, entryPointFileName)),
58
62
  path.join(targetDirectoryPath, '.agent-context'),
59
63
  ];
@@ -122,3 +126,36 @@ export async function createBackup(targetDirectoryPath) {
122
126
  durationMs: Date.now() - startTime
123
127
  };
124
128
  }
129
+
130
+ export async function ensureBackupGitignoreEntry(targetDirectoryPath) {
131
+ const gitignorePath = path.join(targetDirectoryPath, '.gitignore');
132
+ const existingContent = await pathExists(gitignorePath)
133
+ ? await fs.readFile(gitignorePath, 'utf8')
134
+ : '';
135
+ const existingLines = existingContent.split(/\r?\n/).map((line) => line.trim());
136
+
137
+ if (existingLines.includes(BACKUP_GITIGNORE_ENTRY) || existingLines.includes(BACKUP_DIR_NAME)) {
138
+ return {
139
+ status: 'unchanged',
140
+ gitignorePath,
141
+ entry: BACKUP_GITIGNORE_ENTRY,
142
+ };
143
+ }
144
+
145
+ let nextContent = existingContent;
146
+ if (nextContent.length > 0 && !nextContent.endsWith('\n')) {
147
+ nextContent += '\n';
148
+ }
149
+ if (nextContent.length > 0 && !nextContent.endsWith('\n\n')) {
150
+ nextContent += '\n';
151
+ }
152
+ nextContent += `${BACKUP_GITIGNORE_COMMENT}\n${BACKUP_GITIGNORE_ENTRY}\n`;
153
+
154
+ await fs.writeFile(gitignorePath, nextContent, 'utf8');
155
+
156
+ return {
157
+ status: existingContent ? 'updated' : 'created',
158
+ gitignorePath,
159
+ entry: BACKUP_GITIGNORE_ENTRY,
160
+ };
161
+ }
@@ -44,7 +44,7 @@ import {
44
44
  resolveDetectedSetupDecision,
45
45
  } from '../init-detection-flow.mjs';
46
46
  import { runPreflightChecks } from '../preflight.mjs';
47
- import { createBackup } from '../backup.mjs';
47
+ import { createBackup, ensureBackupGitignoreEntry } from '../backup.mjs';
48
48
  import {
49
49
  runProjectDiscovery,
50
50
  generateProjectDocumentation,
@@ -376,6 +376,10 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
376
376
  detectionTransparency.decision.selectedProjectScopeLabel = selectedProjectScopeLabel;
377
377
 
378
378
  await createBackup(resolvedTargetDirectoryPath);
379
+ const backupGitignoreResult = await ensureBackupGitignoreEntry(resolvedTargetDirectoryPath);
380
+ if (backupGitignoreResult.status !== 'unchanged') {
381
+ console.log(`Local backup artifacts ignored in .gitignore (${backupGitignoreResult.entry}).`);
382
+ }
379
383
 
380
384
  await copyGovernanceAssetsToTarget(resolvedTargetDirectoryPath, {
381
385
  includeMcpTemplate: shouldIncludeMcpTemplate,
@@ -41,7 +41,7 @@ import {
41
41
  } from '../compiler.mjs';
42
42
 
43
43
  import { runPreflightChecks } from '../preflight.mjs';
44
- import { createBackup } from '../backup.mjs';
44
+ import { createBackup, ensureBackupGitignoreEntry } from '../backup.mjs';
45
45
  import { performRollback } from '../rollback.mjs';
46
46
  import {
47
47
  detectProjectDocTemplateStaleness,
@@ -399,6 +399,10 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
399
399
  }
400
400
 
401
401
  await createBackup(resolvedTargetDirectoryPath);
402
+ const backupGitignoreResult = await ensureBackupGitignoreEntry(resolvedTargetDirectoryPath);
403
+ if (backupGitignoreResult.status !== 'unchanged') {
404
+ console.log(`Local backup artifacts ignored in .gitignore (${backupGitignoreResult.entry}).`);
405
+ }
402
406
 
403
407
  try {
404
408
  const governanceSyncResult = await copyGovernanceAssetsToTarget(resolvedTargetDirectoryPath, {
@@ -422,8 +422,10 @@ export async function buildCompiledRulesContent({
422
422
  '3. .agent-context/prompts/review-code.md -> review, audit, check, analyze',
423
423
  '4. .agent-context/prompts/bootstrap-design.md -> ui, ux, layout, screen, tailwind, frontend, redesign',
424
424
  'Documentation-first policy:',
425
- '- Create or refine required project docs before implementation: README.md for every fresh or existing project; docs/project-brief.md; docs/architecture-decision-record.md; docs/flow-overview.md; docs/api-contract.md when APIs, firmware endpoints, CLI commands, or web application flows exist; docs/database-schema.md when persistent data exists; and docs/DESIGN.md plus docs/design-intent.json for UI scope.',
425
+ '- Create or refine required project docs before implementation: README.md for every fresh or existing project; docs/doc-index.md whenever docs/ exists; docs/project-brief.md; docs/architecture-decision-record.md; docs/flow-overview.md; docs/api-contract.md when APIs, firmware endpoints, CLI commands, or web application flows exist; docs/database-schema.md when persistent data exists; and docs/DESIGN.md plus docs/design-intent.json for UI scope.',
426
426
  '- Keep README.md public and developer friendly, including for private projects: explain what the project is, who it is for, setup, usage, configuration, and links to deeper docs. Do not put secrets, internal agent notes, private reasoning, or governance policy dumps in it.',
427
+ '- Use docs/doc-index.md as the compact read-routing map before selecting deeper docs. Do not broad-read docs/*.md by default.',
428
+ '- Add PRD, SRS, technical-design, or separate ERD only when project evidence justifies them.',
427
429
  '- Keep docs complete but compact. Add extra docs files only for stable, distinct, or long workflows such as hardware setup, deployment, operations, testing validation, or troubleshooting.',
428
430
  '- Write formal project docs in English by default unless the user explicitly asks for another documentation language.',
429
431
  '- For docs-only/docs-first requests, do not write application, firmware, or UI code until the user asks or approves an implementation plan.',
@@ -546,14 +548,22 @@ export async function buildCompiledRulesContent({
546
548
 
547
549
  if (await pathExists(projectBriefPath)) {
548
550
  const hasRootReadme = await pathExists(path.join(resolvedTargetDirectoryPath, 'README.md'));
549
- const projectDocsEntries = ['project-brief.md'];
551
+ const projectDocsEntries = [];
550
552
  const candidateDocFileNames = [
553
+ 'doc-index.md',
554
+ 'project-brief.md',
551
555
  'architecture-decision-record.md',
556
+ 'technical-design.md',
557
+ 'prd.md',
558
+ 'srs.md',
552
559
  'database-schema.md',
560
+ 'erd.md',
553
561
  'api-contract.md',
554
562
  'flow-overview.md',
555
563
  'DESIGN.md',
556
564
  'design-intent.json',
565
+ 'runbook.md',
566
+ 'troubleshooting.md',
557
567
  ];
558
568
 
559
569
  for (const candidateFileName of candidateDocFileNames) {
@@ -573,6 +583,7 @@ export async function buildCompiledRulesContent({
573
583
  '',
574
584
  'Universal SOP hard block policy:',
575
585
  '- README.md must exist and read as a public and developer entrypoint.',
586
+ '- docs/doc-index.md must exist whenever docs/ exists and act as the compact read-routing map.',
576
587
  '- Stop implementation if docs/project-brief.md is missing.',
577
588
  '- Stop implementation if docs/architecture-decision-record.md (alias: docs/Architecture-Decision-Record.md) is missing.',
578
589
  '- Stop implementation if docs/flow-overview.md is missing.',
@@ -580,6 +591,8 @@ export async function buildCompiledRulesContent({
580
591
  '- If the product exposes API or web application flows, docs/api-contract.md must exist before coding continues.',
581
592
  '- For UI scope, stop implementation if docs/DESIGN.md or docs/design-intent.json is missing.',
582
593
  '- Keep README.md overview-level, public, and developer friendly; do not put secrets, internal agent notes, private reasoning, or governance policy dumps in it.',
594
+ '- Use README.md plus docs/doc-index.md to choose the smallest relevant read set before loading deeper docs.',
595
+ '- Add PRD, SRS, technical-design, or separate ERD only when project evidence justifies them.',
583
596
  '- Materialize missing docs first, then continue coding.',
584
597
  '- Bootstrap missing docs from real repo evidence and the latest user request. Do not write generic placeholder templates.',
585
598
  '- Separate confirmed facts from assumptions and end each major explanation with the next validation action.',
@@ -612,10 +625,12 @@ export async function buildCompiledRulesContent({
612
625
  '',
613
626
  'Bootstrap policy:',
614
627
  '- Create README.md as a public and developer entrypoint before coding continues.',
628
+ '- Create docs/doc-index.md as the compact read-routing map whenever docs/ exists.',
615
629
  '- Hard block: do not write application code until docs/project-brief.md and docs/architecture-decision-record.md exist.',
616
630
  '- docs/flow-overview.md must also exist before coding continues.',
617
631
  '- Add docs/database-schema.md when persistent data is involved.',
618
632
  '- Add docs/api-contract.md when API or web application flows are involved.',
633
+ '- Add PRD, SRS, technical-design, or separate ERD only when project evidence justifies them.',
619
634
  '- For docs-only/docs-first requests, stop after docs unless the user asks for implementation or approves an implementation plan.',
620
635
  '- If docs/project-brief.md is missing, execute bootstrap-project-context prompt immediately.',
621
636
  hasBootstrapDesignPrompt
@@ -6,6 +6,7 @@ export const PROJECT_DOC_FILE_NAMES = [
6
6
  'api-contract.md',
7
7
  'flow-overview.md',
8
8
  ];
9
+ export const DOC_INDEX_FILE_NAME = 'doc-index.md';
9
10
  export const UI_DESIGN_CONTRACT_FILE_NAMES = ['DESIGN.md', 'design-intent.json'];
10
11
 
11
12
  // Legacy project docs may still carry this version header; keep for upgrade staleness checks.
@@ -3,6 +3,7 @@ import fs from 'node:fs/promises';
3
3
  import { askChoice, askYesNo } from '../utils.mjs';
4
4
  import {
5
5
  ARCHITECTURE_STYLE_CHOICES,
6
+ DOC_INDEX_FILE_NAME,
6
7
  DOCKER_STRATEGY_CHOICES,
7
8
  SUPPORTED_DOC_LANGUAGES,
8
9
  } from './constants.mjs';
@@ -169,6 +170,7 @@ export function resolveProjectDocTargets(discoveryAnswers) {
169
170
  || discoveryAnswers.primaryDomain.toLowerCase().includes('fullstack');
170
171
 
171
172
  const requiredDocFileNames = [
173
+ DOC_INDEX_FILE_NAME,
172
174
  'project-brief.md',
173
175
  'architecture-decision-record.md',
174
176
  'flow-overview.md',
@@ -78,7 +78,9 @@ export function buildProjectContextBootstrapPrompt({
78
78
  '12. Treat topology as an agent decision unless the user explicitly constrained it. If monolith fits, explain why. If a service split fits, document the evidence and service boundary logic.',
79
79
  '13. Required docs coverage must include a public and developer README entrypoint, feature plan, architecture rationale, flow, public API or integration contracts when relevant, data model when relevant, UI/design when relevant, security assumptions, testing strategy, runtime/deployment notes, and next validation actions.',
80
80
  '14. README.md must be public and developer friendly, including for private projects: what it is, who it is for, setup, core workflow, configuration, and links to deeper docs. Do not include secrets, internal agent notes, private reasoning, or governance policy dumps.',
81
- '15. Keep docs complete but compact. Add extra docs files only for stable, distinct, or long workflows such as hardware setup, deployment, operations, testing validation, or troubleshooting.',
81
+ '15. docs/doc-index.md is the low-token routing map for docs/*. Keep it short, list each active doc, and explain when an agent should read it. Do not make it the source of truth for requirements or architecture.',
82
+ '16. Keep docs complete but compact. Add extra docs files only for stable, distinct, or long workflows such as hardware setup, deployment, operations, testing validation, or troubleshooting.',
83
+ '17. Add SRS, PRD, technical-design, or ERD docs only when project evidence triggers them. Use PRD for product-roadmap/user-story ownership, SRS for contractual or multi-stakeholder acceptance criteria, technical-design for non-trivial architecture decisions, and ERD only as a separate file when the schema is too complex for docs/database-schema.md.',
82
84
  '',
83
85
  '## Project Inputs',
84
86
  `- Project name: ${discoveryAnswers.projectName}`,
@@ -105,10 +107,12 @@ export function buildProjectContextBootstrapPrompt({
105
107
  '## Required Execution',
106
108
  '1. Create all required docs files listed above with complete Markdown content.',
107
109
  '2. Make the docs adaptive to the real repo and prompt context. These are living references, not frozen templates.',
108
- '3. In docs/project-brief.md and docs/architecture-decision-record.md, include explicit sections for confirmed facts, assumptions to validate, and next validation actions whenever context is incomplete.',
109
- '4. Before implementation, use the docs to confirm stack, runtime, architecture, public contracts, data, validation, and delivery assumptions.',
110
- '5. Keep content original, specific to this project, and actionable for implementation.',
111
- '6. After writing docs, continue coding tasks using these docs as living project context.',
110
+ '3. In docs/doc-index.md, include a compact table with document path, purpose, reads-when triggers, status, and last-updated date.',
111
+ '4. In docs/project-brief.md and docs/architecture-decision-record.md, include explicit sections for confirmed facts, assumptions to validate, and next validation actions whenever context is incomplete.',
112
+ '5. Before implementation, use README.md plus docs/doc-index.md to select only the relevant docs for the current task instead of broad-reading docs/*.md.',
113
+ '6. Before implementation, use the docs to confirm stack, runtime, architecture, public contracts, data, validation, and delivery assumptions.',
114
+ '7. Keep content original, specific to this project, and actionable for implementation.',
115
+ '8. After writing docs, continue coding tasks using these docs as living project context.',
112
116
  '',
113
117
  ].join('\n');
114
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "3.0.46",
3
+ "version": "3.0.47",
4
4
  "type": "module",
5
5
  "description": "Force your AI Agent to code like a Staff Engineer, not a Junior.",
6
6
  "bin": {
@@ -196,6 +196,7 @@ export const REQUIRED_UNIVERSAL_SOP_SNIPPETS = [
196
196
  snippets: [
197
197
  '### 1. Documentation-First Mode',
198
198
  'root `README.md` for every fresh or existing project',
199
+ 'docs/doc-index.md',
199
200
  'Stop after documentation when the user only asked for docs.',
200
201
  'Do not write application, firmware, or UI code',
201
202
  ],
@@ -205,6 +206,7 @@ export const REQUIRED_UNIVERSAL_SOP_SNIPPETS = [
205
206
  snippets: [
206
207
  '## Universal SOP Baseline (Mandatory)',
207
208
  'Root `README.md` must exist for every fresh or existing project',
209
+ '`docs/doc-index.md` must exist whenever `docs/` exists',
208
210
  'Security and testing are non-negotiable baseline requirements.',
209
211
  'If required project context docs are missing, stop implementation and bootstrap docs before writing application code.',
210
212
  ],
@@ -214,6 +216,7 @@ export const REQUIRED_UNIVERSAL_SOP_SNIPPETS = [
214
216
  snippets: [
215
217
  '## Documentation-First Requests',
216
218
  'root `README.md` for every fresh or existing project',
219
+ '`docs/doc-index.md` whenever `docs/` exists',
217
220
  'Stop after docs when the user only asked for docs.',
218
221
  'Write formal project docs in English by default',
219
222
  ],
@@ -230,19 +233,20 @@ export const REQUIRED_UNIVERSAL_SOP_SNIPPETS = [
230
233
  {
231
234
  path: '.agent-context/prompts/review-code.md',
232
235
  snippets: [
233
- 'Enforce Universal SOP hard gate: block coding flow when required project docs are missing (root `README.md`; `docs/architecture-decision-record.md`; and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).',
236
+ 'Enforce Universal SOP hard gate: block coding flow when required project docs are missing (root `README.md`; `docs/doc-index.md` when `docs/` exists; `docs/architecture-decision-record.md`; and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).',
234
237
  ],
235
238
  },
236
239
  {
237
240
  path: '.agent-context/prompts/refactor.md',
238
241
  snippets: [
239
- '6. Enforce Universal SOP hard gate: stop implementation if root `README.md` is missing, if `docs/architecture-decision-record.md` is missing, or for UI scope if `docs/DESIGN.md` or `docs/design-intent.json` is missing.',
242
+ '6. Enforce Universal SOP hard gate: stop implementation if root `README.md` is missing, if `docs/doc-index.md` is missing while `docs/` exists, if `docs/architecture-decision-record.md` is missing, or for UI scope if `docs/DESIGN.md` or `docs/design-intent.json` is missing.',
240
243
  ],
241
244
  },
242
245
  {
243
246
  path: 'lib/cli/compiler.mjs',
244
247
  snippets: [
245
248
  'Universal SOP hard block policy:',
249
+ 'docs/doc-index.md whenever docs/ exists',
246
250
  'README.md must exist and read as a public and developer entrypoint',
247
251
  'Hard block: do not write application code until docs/project-brief.md and docs/architecture-decision-record.md exist.',
248
252
  'Documentation-first policy:',