@damphuquy/agent-init 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -109
- package/dist/cli.js +0 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -4
- package/dist/config.js.map +1 -1
- package/package.json +4 -3
- package/templates/.agents/README.md +29 -0
- package/templates/.agents/behavior.md +72 -0
- package/templates/.agents/conventions/naming.md +55 -0
- package/templates/.agents/guardrails.md +76 -0
- package/templates/AGENTS.md +77 -48
- package/templates/process/README.md +88 -29
- package/templates/process/_seeds/_GUIDE.md +121 -10
- package/templates/process/_seeds/context-group.md.seed +147 -17
- package/templates/process/_seeds/decision-template.md.seed +143 -0
- package/templates/process/_seeds/handoff-template.md.seed +79 -0
- package/templates/process/_seeds/plan-template.md.seed +135 -0
- package/templates/process/_seeds/review-template.md.seed +148 -0
- package/templates/process/_seeds/state-template.md.seed +149 -0
- package/templates/process/_seeds/task-template.md.seed +131 -28
- package/templates/process/context/all-context.md +1 -1
- package/templates/.agents/name_rule.md +0 -3
package/README.md
CHANGED
|
@@ -1,134 +1,66 @@
|
|
|
1
|
-
#
|
|
1
|
+
# agent-instructions
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
CLI sở hữu giao diện trực quan với phong cách **Tokyo Night Theme**, hỗ trợ hiển thị trạng thái chi tiết, thống kê quá trình cài đặt và hướng dẫn các bước tiếp theo.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 1. Khởi tạo nhanh với NPX (Khuyên dùng)
|
|
10
|
-
|
|
11
|
-
Không cần cài đặt toàn cục hay clone repository, bạn có thể khởi tạo trực tiếp bất kỳ lúc nào:
|
|
3
|
+
Template hệ thống điều phối AI Coding Agent theo chuẩn **RIPER-5 Framework** — bao gồm ba layer rõ ràng: `AGENTS.md` (entry point), `.agents/` (agent control), và `process/` (engineering workflow).
|
|
12
4
|
|
|
13
5
|
```bash
|
|
14
|
-
#
|
|
15
|
-
npx @damphuquy/agent-init .
|
|
16
|
-
|
|
17
|
-
# Khởi tạo vào thư mục / subsystem chỉ định
|
|
6
|
+
# Bootstrap ngay vào project của bạn
|
|
18
7
|
npx @damphuquy/agent-init ./my-project
|
|
19
|
-
npx @damphuquy/agent-init ./services/billing
|
|
20
8
|
```
|
|
21
9
|
|
|
22
10
|
---
|
|
23
11
|
|
|
24
|
-
##
|
|
12
|
+
## Kiến trúc 3-layer
|
|
25
13
|
|
|
26
|
-
|
|
14
|
+
```
|
|
15
|
+
AGENTS.md ← Entry point: project config + RIPER-5 phase definitions
|
|
16
|
+
.agents/ ← Agent control layer: behavior, guardrails, conventions
|
|
17
|
+
process/ ← Engineering workflow: task artifacts, seeds, context
|
|
18
|
+
```
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
npm run build
|
|
20
|
+
Mỗi layer có trách nhiệm độc lập và không duplicate nhau.
|
|
21
|
+
Chi tiết → [`docs/01-overview.md`](docs/01-overview.md)
|
|
31
22
|
|
|
32
|
-
|
|
33
|
-
npm start -- [target_directory] [options]
|
|
23
|
+
---
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
node dist/cli.js [target_directory] [options]
|
|
37
|
-
node bin/bootstrap.js [target_directory] [options]
|
|
38
|
-
```
|
|
25
|
+
## Tài liệu hướng dẫn
|
|
39
26
|
|
|
40
|
-
|
|
27
|
+
| Tài liệu | Nội dung |
|
|
28
|
+
|---|---|
|
|
29
|
+
| [01 · Overview & Architecture](docs/01-overview.md) | Mental model, 3-layer design, quick-start |
|
|
30
|
+
| [02 · Layer: `.agents/`](docs/02-layer-agents.md) | File-by-file: behavior, guardrails, conventions |
|
|
31
|
+
| [03 · Layer: `process/`](docs/03-layer-process.md) | File-by-file: seeds, context, protocols, artifact chain |
|
|
32
|
+
| [04 · Layer: `AGENTS.md`](docs/04-layer-agentsmd.md) | Entry point anatomy, customization |
|
|
33
|
+
| [05 · Workflow: Tạo task mới](docs/05-workflow-new-task.md) | Tutorial từng bước RIPER-5 |
|
|
34
|
+
| [06 · Human vs Agent](docs/06-human-vs-agent.md) | Phân rõ ai làm gì ở từng bước |
|
|
35
|
+
| [07 · Deployment](docs/07-deployment.md) | Bootstrap, cài đặt, cấu hình lần đầu |
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
---
|
|
43
38
|
|
|
44
|
-
-
|
|
45
|
-
- `-h, --help`: Hiển thị bảng trợ giúp và các ví dụ sử dụng.
|
|
46
|
-
- `-v, --version`: Hiển thị phiên bản hiện tại.
|
|
39
|
+
## Quick-start (5 phút)
|
|
47
40
|
|
|
48
|
-
Ví dụ:
|
|
49
41
|
```bash
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
---
|
|
42
|
+
# 1. Bootstrap template vào project
|
|
43
|
+
npx @damphuquy/agent-init ./my-project
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
```text
|
|
58
|
-
.
|
|
59
|
-
├── src/ # Mã nguồn TypeScript (đầy đủ Type definitions)
|
|
60
|
-
│ ├── types.ts # Interfaces, Types cho Palette, Theme, FileGroups, Options, Stats
|
|
61
|
-
│ ├── theme.ts # Tokyo Night Color Engine & ANSI formatters
|
|
62
|
-
│ ├── config.ts # File classification catalog & package info
|
|
63
|
-
│ ├── ui.ts # Box renderer, Banner & Help documentation UI
|
|
64
|
-
│ ├── scaffolder.ts # Core Scaffolding Engine
|
|
65
|
-
│ ├── cli.ts # CLI argument parser & runner entrypoint
|
|
66
|
-
│ └── index.ts # Public library exports
|
|
67
|
-
├── templates/ # Toàn bộ template gốc (chỉnh sửa trực tiếp tại đây)
|
|
68
|
-
│ ├── AGENTS.md # Master Agent Manual (4 Pillars & RIPER-5 Loop)
|
|
69
|
-
│ ├── .agents/name_rule.md # Quy tắc đặt tên và interface
|
|
70
|
-
│ └── process/
|
|
71
|
-
│ ├── README.md # Trung tâm điều hành task process
|
|
72
|
-
│ ├── _seeds/ # Các seed templates (task, program, context)
|
|
73
|
-
│ │ ├── _GUIDE.md
|
|
74
|
-
│ │ ├── task-template.md.seed
|
|
75
|
-
│ │ ├── program-template.md.seed
|
|
76
|
-
│ │ └── context-group.md.seed
|
|
77
|
-
│ ├── context/ # Context routers & Planning standards
|
|
78
|
-
│ ├── development-protocols/ # Giao thức lập trình & điều phối
|
|
79
|
-
│ ├── features/ # Thư mục active/backlog/completed cho features
|
|
80
|
-
│ └── general-plans/ # Thư mục active/backlog/completed cho general plans
|
|
81
|
-
├── dist/ # Compiled JavaScript & Type Declaration files (.d.ts)
|
|
82
|
-
├── bin/
|
|
83
|
-
│ └── bootstrap.js # CLI runner forwarder
|
|
84
|
-
├── tsconfig.json # TypeScript Compiler Configuration (Strict mode)
|
|
85
|
-
└── package.json
|
|
86
|
-
```
|
|
45
|
+
# 2. Mở AGENTS.md, cấu hình toolchain (2 phút)
|
|
46
|
+
# Tìm dòng <validation_commands> và điền lệnh test/lint của project
|
|
87
47
|
|
|
88
|
-
|
|
48
|
+
# 3. Tạo task đầu tiên
|
|
49
|
+
cp my-project/process/_seeds/task-template.md.seed \
|
|
50
|
+
my-project/process/general-plans/active/CHG-001-init/task.md
|
|
89
51
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
```text
|
|
93
|
-
<target_dir>/
|
|
94
|
-
├── AGENTS.md # Master Agent Guidelines (4 Pillars + RIPER-5 Framework)
|
|
95
|
-
├── .agents/
|
|
96
|
-
│ └── name_rule.md # Quy tắc đặt tên và interface
|
|
97
|
-
└── process/
|
|
98
|
-
├── README.md # Trung tâm điều hành task process
|
|
99
|
-
├── _seeds/ # Blueprints / Templates gốc (Read-only)
|
|
100
|
-
│ ├── _GUIDE.md # Hướng dẫn sử dụng seeds
|
|
101
|
-
│ ├── task-template.md.seed # Template cho task đơn lẻ (SPEC, PLAN, AC)
|
|
102
|
-
│ ├── program-template.md.seed # Blueprint cho chương trình đa pha
|
|
103
|
-
│ └── context-group.md.seed # Seed cho router ngữ cảnh domain
|
|
104
|
-
├── context/
|
|
105
|
-
│ ├── all-context.md # Root context router
|
|
106
|
-
│ └── planning/all-planning.md # Tiêu chuẩn INVEST, capacity planning
|
|
107
|
-
├── development-protocols/
|
|
108
|
-
│ ├── all-development-protocols.md # Protocols index
|
|
109
|
-
│ ├── orchestration.md # Quy tắc subagent delegation
|
|
110
|
-
│ └── implementation-standards.md # Chuẩn typing, domain purity, testing
|
|
111
|
-
├── features/ # Quản lý task theo feature/domain
|
|
112
|
-
│ ├── active/ # Task đang thực thi ({task_slug}_{date}/)
|
|
113
|
-
│ ├── backlog/ # Task chờ xử lý ({note_slug}_NOTE_{date}.md)
|
|
114
|
-
│ └── completed/ # Task đã hoàn thành
|
|
115
|
-
└── general-plans/ # Quản lý task cross-cutting / độc lập
|
|
116
|
-
├── active/
|
|
117
|
-
├── backlog/
|
|
118
|
-
└── completed/
|
|
52
|
+
# 4. Yêu cầu agent bắt đầu
|
|
53
|
+
# "Đọc AGENTS.md và task.md, bắt đầu phase RESEARCH"
|
|
119
54
|
```
|
|
120
55
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
## 6. Các bước sau khi khởi tạo
|
|
56
|
+
Hướng dẫn chi tiết → [`docs/07-deployment.md`](docs/07-deployment.md)
|
|
124
57
|
|
|
125
|
-
|
|
126
|
-
Mở file `<target_dir>/AGENTS.md` và tùy chỉnh các lệnh kiểm thử tại phần `<validation_commands>` phù hợp với stack công nghệ của dự án (ví dụ: `npm test`, `pytest`, `cargo test`, `go test ./...`).
|
|
58
|
+
---
|
|
127
59
|
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
cp process/_seeds/task-template.md.seed process/general-plans/active/01-init_PLAN.md
|
|
131
|
-
```
|
|
60
|
+
## NPX Options
|
|
132
61
|
|
|
133
|
-
|
|
134
|
-
|
|
62
|
+
```bash
|
|
63
|
+
npx @damphuquy/agent-init . # Bootstrap tại thư mục hiện tại
|
|
64
|
+
npx @damphuquy/agent-init ./services/billing # Bootstrap vào subsystem cụ thể
|
|
65
|
+
npx @damphuquy/agent-init ./my-project --force # Ghi đè file đã tồn tại
|
|
66
|
+
```
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAyD3C,CAAC;AAEF,wBAAgB,cAAc,IAAI,MAAM,CASvC;AAED,wBAAgB,cAAc,CAAC,cAAc,GAAE,MAAyB,GAAG,WAAW,CAgBrF"}
|
package/dist/config.js
CHANGED
|
@@ -4,10 +4,18 @@ import process from 'node:process';
|
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
export const FILE_GROUPS = [
|
|
6
6
|
{
|
|
7
|
-
title: 'Core Agent Manual &
|
|
7
|
+
title: 'Core Agent Manual & Entry Point',
|
|
8
8
|
files: [
|
|
9
9
|
{ path: 'AGENTS.md', desc: 'Master Agent Manual (4 Pillars & RIPER-5 Loop)' },
|
|
10
|
-
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
title: 'Agent Control Layer (.agents/)',
|
|
14
|
+
files: [
|
|
15
|
+
{ path: '.agents/README.md', desc: 'Agent control layer index & boundary declaration' },
|
|
16
|
+
{ path: '.agents/behavior.md', desc: 'Mode declaration, session startup, context navigation' },
|
|
17
|
+
{ path: '.agents/guardrails.md', desc: 'Retry budget, escalation triggers, completion gate' },
|
|
18
|
+
{ path: '.agents/conventions/naming.md', desc: 'Universal naming rules & structural hygiene' },
|
|
11
19
|
],
|
|
12
20
|
},
|
|
13
21
|
{
|
|
@@ -15,9 +23,14 @@ export const FILE_GROUPS = [
|
|
|
15
23
|
files: [
|
|
16
24
|
{ path: 'process/README.md', desc: 'Operational Workspace Control Center' },
|
|
17
25
|
{ path: 'process/_seeds/_GUIDE.md', desc: 'Seed archetypes usage & lifecycle guide' },
|
|
18
|
-
{ path: 'process/_seeds/task-template.md.seed', desc: 'Task
|
|
26
|
+
{ path: 'process/_seeds/task-template.md.seed', desc: 'Task master contract & RIPER-5 execution plan' },
|
|
27
|
+
{ path: 'process/_seeds/context-group.md.seed', desc: 'Research phase artifact blueprint' },
|
|
28
|
+
{ path: 'process/_seeds/decision-template.md.seed', desc: 'Innovate phase artifact & Gate 1 memory' },
|
|
29
|
+
{ path: 'process/_seeds/plan-template.md.seed', desc: 'Plan phase artifact & execution contract (Gate 2)' },
|
|
30
|
+
{ path: 'process/_seeds/state-template.md.seed', desc: 'Execute loop persistent memory' },
|
|
31
|
+
{ path: 'process/_seeds/review-template.md.seed', desc: 'Review phase artifact & Gate 3' },
|
|
32
|
+
{ path: 'process/_seeds/handoff-template.md.seed', desc: 'Final projection (intentionally short)' },
|
|
19
33
|
{ path: 'process/_seeds/program-template.md.seed', desc: 'Multi-phase umbrella epic blueprint' },
|
|
20
|
-
{ path: 'process/_seeds/context-group.md.seed', desc: 'Domain knowledge & context router blueprint' },
|
|
21
34
|
],
|
|
22
35
|
},
|
|
23
36
|
{
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM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IAAI,CAAC,GAAG,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACjD,8CAA8C;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,cAAc,GAAW,cAAc,EAAE;IACtE,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC7D,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAyB,CAAC;YAC3D,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,uBAAuB;gBAC5C,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,OAAO;gBAClC,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,WAAW;IACb,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@damphuquy/agent-init",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Scaffolding CLI to bootstrap RIPER-5 Coding Agents & Operational Workspace",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"agent-init": "./
|
|
9
|
+
"agent-init": "./bin/bootstrap.js",
|
|
10
|
+
"@damphuquy/agent-init": "./bin/bootstrap.js"
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
12
13
|
"dist",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"access": "public"
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
21
|
+
"build": "tsc && chmod +x dist/cli.js",
|
|
21
22
|
"typecheck": "tsc --noEmit",
|
|
22
23
|
"prepublishOnly": "npm run build",
|
|
23
24
|
"start": "node ./dist/cli.js",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Agent Control Layer (`.agents/`)
|
|
2
|
+
|
|
3
|
+
<agent_control_layer version="1.0">
|
|
4
|
+
|
|
5
|
+
<purpose>
|
|
6
|
+
Universal, project-agnostic agent control rules. These files define HOW the
|
|
7
|
+
agent thinks and behaves — not what it builds or how tasks are tracked.
|
|
8
|
+
|
|
9
|
+
Copy this directory verbatim into any repository. No project-specific edits required.
|
|
10
|
+
</purpose>
|
|
11
|
+
|
|
12
|
+
<boundary>
|
|
13
|
+
`.agents/` owns: mode declaration, session startup protocol, retry budgets,
|
|
14
|
+
escalation triggers, completion gate, and code/naming conventions.
|
|
15
|
+
|
|
16
|
+
`.agents/` NEVER owns: task workflow (→ `process/`), artifact chain
|
|
17
|
+
(→ `process/_seeds/`), toolchain commands (→ `AGENTS.md`), or project context
|
|
18
|
+
(→ `process/context/`).
|
|
19
|
+
</boundary>
|
|
20
|
+
|
|
21
|
+
## File Catalog
|
|
22
|
+
|
|
23
|
+
| File | Purpose |
|
|
24
|
+
|------|---------|
|
|
25
|
+
| [`behavior.md`](behavior.md) | Mode declaration, session startup, persistent state reload |
|
|
26
|
+
| [`guardrails.md`](guardrails.md) | Retry budget, escalation triggers, stop conditions, completion gate |
|
|
27
|
+
| [`conventions/naming.md`](conventions/naming.md) | Universal naming and code hygiene rules |
|
|
28
|
+
|
|
29
|
+
</agent_control_layer>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Agent Behavior Protocol
|
|
2
|
+
|
|
3
|
+
<behavior_protocol version="1.0">
|
|
4
|
+
|
|
5
|
+
<description>
|
|
6
|
+
Universal rules governing HOW the agent declares its operating mode,
|
|
7
|
+
reloads state at session start, and navigates context. Project-agnostic.
|
|
8
|
+
</description>
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Mode Declaration
|
|
13
|
+
|
|
14
|
+
Every response that advances a task MUST open with a mode declaration on the
|
|
15
|
+
first line. The declared mode must match the current phase recorded in `task.md`.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
[MODE: RESEARCH] — read-only, no source changes
|
|
19
|
+
[MODE: INNOVATE] — generating options, no source changes
|
|
20
|
+
[MODE: PLAN] — writing plan artifacts, no source changes
|
|
21
|
+
[MODE: EXECUTE] — making scoped source changes
|
|
22
|
+
[MODE: REVIEW] — reviewing, no code fixes
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Omit the mode declaration only for pure conversational exchanges that do not
|
|
26
|
+
advance a task (e.g., answering a factual question, clarifying scope).
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. Session Startup Protocol
|
|
31
|
+
|
|
32
|
+
Before continuing any in-progress task, reload persistent state in this order:
|
|
33
|
+
|
|
34
|
+
<startup_sequence>
|
|
35
|
+
1. Read `task.md` — confirm current phase and open gates.
|
|
36
|
+
2. Read `research.md` if Research phase is complete.
|
|
37
|
+
3. Read `decision.md` if Innovate phase is complete — confirm approved decisions.
|
|
38
|
+
4. Read `plan.md` — confirm current slice index and scope contract.
|
|
39
|
+
5. Read `state.md` — confirm completed slices, failure memory, retry budget, next action.
|
|
40
|
+
6. Re-read any source files that changed since last context load.
|
|
41
|
+
</startup_sequence>
|
|
42
|
+
|
|
43
|
+
**Do NOT rely on conversation memory alone.** Always verify against the
|
|
44
|
+
file-based artifacts listed above.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 3. Context Navigation Rules
|
|
49
|
+
|
|
50
|
+
<context_rules>
|
|
51
|
+
<rule id="minimum_context">
|
|
52
|
+
Gather minimum sufficient context only. Never scan the full repository or
|
|
53
|
+
perform drive-by refactoring outside the active task scope.
|
|
54
|
+
</rule>
|
|
55
|
+
|
|
56
|
+
<rule id="information_priority">
|
|
57
|
+
Load context in this priority order:
|
|
58
|
+
1. Task spec and acceptance criteria (`task.md`)
|
|
59
|
+
2. Research and decision artifacts (`research.md`, `decision.md`)
|
|
60
|
+
3. Relevant test suites
|
|
61
|
+
4. Domain models and port interfaces
|
|
62
|
+
5. Configuration and dependency injection setup
|
|
63
|
+
6. Concrete infrastructure implementations
|
|
64
|
+
</rule>
|
|
65
|
+
|
|
66
|
+
<rule id="no_stale_context">
|
|
67
|
+
Re-read relevant files after any repository change. Never act on stale
|
|
68
|
+
in-memory snapshots.
|
|
69
|
+
</rule>
|
|
70
|
+
</context_rules>
|
|
71
|
+
|
|
72
|
+
</behavior_protocol>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Naming & Code Conventions
|
|
2
|
+
|
|
3
|
+
<naming_conventions version="1.0">
|
|
4
|
+
|
|
5
|
+
<description>
|
|
6
|
+
Universal code hygiene rules that apply across languages and projects.
|
|
7
|
+
Project-specific linting/formatting rules live in `AGENTS.md` and
|
|
8
|
+
`process/development-protocols/implementation-standards.md`.
|
|
9
|
+
</description>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Naming Rules
|
|
14
|
+
|
|
15
|
+
<naming_rules>
|
|
16
|
+
<rule id="no_leading_underscore">
|
|
17
|
+
Never use a leading underscore `_` for function or method names to imply
|
|
18
|
+
"private". Write flat, clean, public functions with self-explanatory names.
|
|
19
|
+
Exception: language-mandated dunder/magic methods (e.g., Python `__init__`).
|
|
20
|
+
</rule>
|
|
21
|
+
|
|
22
|
+
<rule id="self_explanatory">
|
|
23
|
+
Names must reveal intent without requiring a comment to explain them.
|
|
24
|
+
Prefer `calculate_retry_delay()` over `calc()` or `do_thing()`.
|
|
25
|
+
</rule>
|
|
26
|
+
|
|
27
|
+
<rule id="no_abbreviations">
|
|
28
|
+
Avoid opaque abbreviations. Write `connection_timeout` not `conn_to`,
|
|
29
|
+
`maximum_retry_count` not `max_rtry_cnt`.
|
|
30
|
+
Exception: universally understood acronyms (e.g., `url`, `id`, `api`).
|
|
31
|
+
</rule>
|
|
32
|
+
</naming_rules>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 2. Structural Hygiene
|
|
37
|
+
|
|
38
|
+
<structural_rules>
|
|
39
|
+
<rule id="single_responsibility">
|
|
40
|
+
Each function or class has one clearly stated responsibility.
|
|
41
|
+
Split when a unit does more than one thing.
|
|
42
|
+
</rule>
|
|
43
|
+
|
|
44
|
+
<rule id="no_magic_values">
|
|
45
|
+
Extract all numeric/string literals into named constants or configuration.
|
|
46
|
+
</rule>
|
|
47
|
+
|
|
48
|
+
<rule id="no_suppression">
|
|
49
|
+
Never silence linter or type checker errors with inline suppression comments
|
|
50
|
+
(`# type: ignore`, `# noqa`, `eslint-disable`, `@SuppressWarnings`, etc.)
|
|
51
|
+
unless the suppression itself is explicitly reviewed and annotated with a reason.
|
|
52
|
+
</rule>
|
|
53
|
+
</structural_rules>
|
|
54
|
+
|
|
55
|
+
</naming_conventions>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Agent Guardrails
|
|
2
|
+
|
|
3
|
+
<agent_guardrails version="1.0">
|
|
4
|
+
|
|
5
|
+
<description>
|
|
6
|
+
Universal safety boundaries for agent execution: retry budget, escalation
|
|
7
|
+
triggers, stop conditions, and completion gate. Project-agnostic — applies
|
|
8
|
+
regardless of language, framework, or toolchain.
|
|
9
|
+
</description>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Retry Budget
|
|
14
|
+
|
|
15
|
+
<retry_budget max_attempts="3">
|
|
16
|
+
Maximum 3 consecutive attempts per distinct failure symptom.
|
|
17
|
+
|
|
18
|
+
Rules:
|
|
19
|
+
- Never suppress errors with flags (e.g. `# type: ignore`, `eslint-disable`,
|
|
20
|
+
`@SuppressWarnings`) to artificially pass a gate.
|
|
21
|
+
- Record every failure in `state.md > <failure_memory>` with:
|
|
22
|
+
- failure signature (unique symptom description)
|
|
23
|
+
- hypothesis tested
|
|
24
|
+
- experiment run
|
|
25
|
+
- result observed
|
|
26
|
+
- If retry budget is exhausted: HALT, log into `<open_decisions>` in `task.md`,
|
|
27
|
+
and request human guidance.
|
|
28
|
+
</retry_budget>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. Escalation & Stop Conditions
|
|
33
|
+
|
|
34
|
+
<escalation_triggers>
|
|
35
|
+
Halt immediately and request human guidance if ANY of the following occur:
|
|
36
|
+
|
|
37
|
+
1. Retry budget exhausted on a recurring failure.
|
|
38
|
+
2. Required change touches a public API, database schema, or security policy
|
|
39
|
+
not declared in the approved plan.
|
|
40
|
+
3. Required change touches a file outside the scope defined in `plan.md`.
|
|
41
|
+
4. A business or policy decision is needed that is not in `<approved_decisions>`.
|
|
42
|
+
5. Scope expansion is needed beyond `<out_of_scope>` in `task.md`.
|
|
43
|
+
|
|
44
|
+
Exception: Do NOT halt if the change was explicitly authorized by the user
|
|
45
|
+
in the prompt/spec, or if it is a mandatory accompanying test or import update.
|
|
46
|
+
</escalation_triggers>
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 3. Completion Gate
|
|
51
|
+
|
|
52
|
+
<completion_gate>
|
|
53
|
+
A task is COMPLETE only when ALL of the following are true simultaneously:
|
|
54
|
+
|
|
55
|
+
1. All Acceptance Criteria in `task.md` are verified (`- [x]`) with
|
|
56
|
+
evidence recorded in `review.md`.
|
|
57
|
+
2. All validation commands (as defined in `AGENTS.md`) execute with
|
|
58
|
+
zero errors and zero warnings.
|
|
59
|
+
3. Gate 3 in `review.md` is checked and review decision is PASS.
|
|
60
|
+
4. The final `git diff` contains zero extraneous or unreviewed modifications.
|
|
61
|
+
5. Task folder is moved to `completed/` and `handoff.md` is produced.
|
|
62
|
+
</completion_gate>
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 4. Invariant Preservation
|
|
67
|
+
|
|
68
|
+
<invariants>
|
|
69
|
+
- Never overwrite or delete human-authored spec content in `task.md`.
|
|
70
|
+
- Only toggle `- [x]` after the corresponding verifier actually passes —
|
|
71
|
+
never preemptively.
|
|
72
|
+
- Keep edits within the declared subsystem unless explicit cross-system
|
|
73
|
+
coordination is requested and approved.
|
|
74
|
+
</invariants>
|
|
75
|
+
|
|
76
|
+
</agent_guardrails>
|