deuk-agent-rule 2.5.14 β†’ 3.3.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.
Files changed (44) hide show
  1. package/CHANGELOG.ko.md +74 -0
  2. package/CHANGELOG.md +137 -322
  3. package/README.ko.md +134 -154
  4. package/README.md +121 -153
  5. package/package.json +29 -7
  6. package/scripts/cli-args.mjs +87 -3
  7. package/scripts/cli-init-commands.mjs +1382 -223
  8. package/scripts/cli-init-logic.mjs +28 -16
  9. package/scripts/cli-prompts.mjs +13 -4
  10. package/scripts/cli-rule-compiler.mjs +44 -34
  11. package/scripts/cli-skill-commands.mjs +172 -0
  12. package/scripts/cli-telemetry-commands.mjs +429 -0
  13. package/scripts/cli-ticket-commands.mjs +1934 -161
  14. package/scripts/cli-ticket-index.mjs +298 -0
  15. package/scripts/cli-ticket-migration.mjs +320 -0
  16. package/scripts/cli-ticket-parser.mjs +207 -0
  17. package/scripts/cli-utils.mjs +381 -59
  18. package/scripts/cli.mjs +99 -19
  19. package/scripts/lint-md.mjs +247 -0
  20. package/scripts/lint-rules.mjs +143 -0
  21. package/scripts/merge-logic.mjs +13 -324
  22. package/scripts/plan-parser.mjs +53 -0
  23. package/templates/MODULE_RULE_TEMPLATE.md +11 -0
  24. package/templates/PROJECT_RULE.md +47 -0
  25. package/templates/TICKET_TEMPLATE.ko.md +21 -0
  26. package/templates/TICKET_TEMPLATE.md +21 -0
  27. package/templates/rules.d/deukcontext-mcp.md +31 -0
  28. package/templates/rules.d/platform-coexistence.md +29 -0
  29. package/templates/skills/context-recall/SKILL.md +25 -0
  30. package/templates/skills/generated-file-guard/SKILL.md +25 -0
  31. package/templates/skills/safe-refactor/SKILL.md +25 -0
  32. package/bundle/.cursorrules +0 -11
  33. package/bundle/AGENTS.md +0 -146
  34. package/bundle/gemini.md +0 -26
  35. package/bundle/rules/delivery-and-parallel-work.mdc +0 -26
  36. package/bundle/rules/git-commit.mdc +0 -24
  37. package/bundle/rules/multi-ai-workflow.mdc +0 -104
  38. package/bundle/rules.d/core-workflow.md +0 -48
  39. package/bundle/rules.d/deukrag-mcp.md +0 -37
  40. package/bundle/templates/MODULE_RULE_TEMPLATE.md +0 -24
  41. package/bundle/templates/TICKET_TEMPLATE.md +0 -58
  42. package/scripts/cli-ticket-logic.mjs +0 -568
  43. package/scripts/sync-bundle.mjs +0 -77
  44. package/scripts/sync-oss.mjs +0 -126
package/README.md CHANGED
@@ -1,209 +1,177 @@
1
1
  <div align="center">
2
2
  <br />
3
- <h1>DeukAgentRules</h1>
3
+ <img src="docs/assets/architecture-v3.png" width="800" alt="DeukAgentRules Architecture" />
4
+ <br />
5
+ <h1>DeukAgentRules v3.3.2</h1>
4
6
  <p>
5
7
  <a href="https://www.npmjs.com/package/deuk-agent-rule"><img src="https://img.shields.io/npm/v/deuk-agent-rule.svg" alt="npm version" /></a>
6
8
  <a href="https://www.npmjs.com/package/deuk-agent-rule"><img src="https://img.shields.io/npm/dt/deuk-agent-rule.svg" alt="npm downloads" /></a>
7
9
  </p>
8
- <p><b>High-Signal Encoding & Rule Standardization Engine</b></p>
10
+ <p><b>AI coding agent guardrails for every repo</b></p>
11
+ <p><i>Ticketed scope, verification, and memory for Codex, Copilot, Claude Code, Cursor, and more</i></p>
9
12
  <p>Part of the <a href="https://deukpack.app">Deuk Family</a> ecosystem.</p>
10
13
  </div>
11
14
 
12
- > A core module of the **Deuk Family**. Maximizes collaboration efficiency of AI agents through structured rules.
15
+ ---
13
16
 
14
- **npm package:** `deuk-agent-rule` Β· **CLI:** `deuk-agent-rule`
17
+ **DeukAgentRules** gives AI coding agents a shared way to work through tickets, scope contracts, verification, and durable project memory.
15
18
 
16
- **Korean:** [README.ko.md](https://github.com/joygram/DeukAgentRules/blob/master/README.ko.md)
19
+ It is more than a prompt pack. It is a repository-level workflow layer that standardizes collaboration through the **Hub-Spoke Architecture** and a **Ticket-Driven Execution Model** while keeping `AGENTS.md`, Copilot instructions, Cursor rules, Claude skills, and related agent surfaces aligned.
17
20
 
18
- A **submodule-isolated collaborative framework** designed to be used alongside various coding agents such as Cursor, GitHub Copilot, Gemini / Antigravity, Claude, Windsurf, and JetBrains AI Assistant.
19
- It standardizes project rules (`AGENTS.md`, `.cursor/rules`) and strongly prevents wasteful prompt token consumption and AI context hallucination through a **ticket-based workflow**.
21
+ Ticket management lives under `.deuk-agent/`, with active work tracked in `.deuk-agent/tickets/` and related docs, plans, and archive data kept alongside it.
20
22
 
21
- > **πŸš€ Core Value:**
22
- > Compresses the mandatory loaded context of approx. 1,500~2,000 tokens per session down to a mere 200~300 tokens. By isolating the AI to a specific **"Target Submodule"** using exact tickets (work orders), it prevents the AI from wandering through an entire monolithic repository.
23
+ > **Current readiness:**
24
+ > v3.3.2 is deployment-ready for agent-driven repositories. It is currently most reliable in **OpenAI Codex** and **GitHub Copilot** workflows. Cursor, Windsurf, Claude Code, and MCP remain supported through pointer-style integration, but they should be validated per workspace before rollout. MCP server registration is separate from `init`.
23
25
 
24
- ### πŸ“’ What's New in v2.4
25
- In the latest v2.4 release, the **Dynamic Rule Assembly Engine** has been introduced. The script automatically detects your project environment (e.g., DeukRag MCP integration) and injects only the necessary context-aware rules into `AGENTS.md`.
26
- The CLI ticketing system has also been upgraded: running `deuk-agent-rule ticket create` now automatically scaffolds design Plan documents and links them to the ticket, heavily reinforcing the Phase-based issue tracking workflow.
26
+ > **Architecture foundation:**
27
+ > We have officially deprecated monolithic `.cursorrules`. v3.0 introduces the **Hub-Spoke model** where `AGENTS.md` is the single source of truth, and IDE-specific rules act as thin entry-point pointers.
27
28
 
28
- > **πŸ’‘ RAG Engine Integration Guide (Coming Soon)**
29
- > We are currently preparing an advanced integration manual and feature update. This will perfectly integrate these agent rules with our internal knowledge search engine **DeukRag (MCP)**, allowing your AI agent to automatically search past tickets and internal conventions to maximize its contextual awareness and problem-solving effectiveness!
29
+ ### πŸ—ΊοΈ Main Features & Architecture
30
30
 
31
- ---
31
+ DeukAgentRules brings four core capabilities to day-to-day AI engineering:
32
32
 
33
- ## πŸ› οΈ Getting Started (Workspace Initialization)
33
+ 1. **Zero-Copy Hub-Spoke Architecture**
34
+ - **Hub**: `AGENTS.md` acts as the global single source of truth.
35
+ - **Spoke**: IDE-specific rules (like `.cursorrules`) or `PROJECT_RULE.md` act as thin pointers.
36
+ - **Benefit**: Eliminates rule duplication, preventing conflicting instructions and context hallucination across different IDEs (Cursor, Copilot, Windsurf).
34
37
 
35
- Since this CLI tool is used frequently across multiple repositories and submodules, a **global installation is highly recommended**.
38
+ 2. **Ticket-Driven Workflow (TDW)**
39
+ - Guides work through a clear lifecycle: Plan β†’ Execute β†’ Verify β†’ Archive.
40
+ - Keeps changes connected to an active ticket in `.deuk-agent/tickets/`, so scope and progress stay visible.
36
41
 
37
- ```bash
38
- npm install -g deuk-agent-rule
39
- deuk-agent-rule init
40
- ```
42
+ 3. **Platform Co-existence & Mode-Aware Workflow Gate**
43
+ - Uses strong Agent Permission Contracts (APC) through a **Mode-Aware** workflow.
44
+ - In **Plan Mode**, agents focus on analysis and planning artifacts before moving into approved execution.
45
+ - Integrates with MCP Soft Gates to keep code changes aligned with the current ticket context.
41
46
 
42
- > [!NOTE]
43
- > **Global Install Permission Troubleshooting**:
44
- > - **Linux/macOS**: Running `npm install -g` may result in `EACCES` permission errors. It is highly recommended to use a Node version manager (`nvm`, `fnm`, etc.) to bypass these constraints. If using the system Node installation, you may unavoidably need to use `sudo npm install -g deuk-agent-rule`.
45
- > - **Windows**: If Node.js is installed in a system directory like `Program Files`, you must run your terminal (PowerShell/CMD) as an **Administrator** for the global installation to complete successfully.
47
+ 4. **Zero-Token Knowledge Distillation**
48
+ - When a ticket is archived, it is distilled into a zero-token summary and moved to `reports/`.
49
+ - These reports are vectorized into DeukAgentContext, building a permanent Engineering Memory Engine without cluttering the agent's active context window.
46
50
 
47
- ### πŸ’‘ Why Global Installation?
51
+ ### Why Not Just Instructions?
48
52
 
49
- > [!WARNING]
50
- > **Submodule Local Installation STRICTLY FORBIDDEN**: Never install `deuk-agent-rule` locally (e.g., `npm install deuk-agent-rule`) inside your target consumer submodules. Doing so creates a "Local Trap" where `npx` prioritizes the outdated local `node_modules` over the globally installed latest version, leading to severe ticket formatting errors and logic mismatches.
53
+ The agent tooling space already has useful building blocks: `AGENTS.md`, GitHub Copilot instructions, Cursor rules, Claude skills, agent launchers, and general LLM guardrail frameworks. DeukAgentRules is positioned one layer above plain instruction sync: it turns those surfaces into a ticketed repository workflow.
51
54
 
52
- 1. **Preventing `npx` Cache & Local Trap Issues**: Running `npx deuk-agent-rule` relies on the local npm cache and `node_modules` resolution. If a stale version is present locally, it will silently hijack the execution. This has been proven to cause severe agent hallucinations or ticket formatting errors (e.g., missing hostname sequence IDs).
53
- 2. **Execution Speed**: The chatbot agent receives instant CLI responses without the overhead of `npx` checking for temporary package downloads.
54
- 3. **Cross-Repository Consistency**: It allows you to reliably apply the exact same version of the agent rules across various submodules and independent microservices in the Deuk Family ecosystem.
55
+ | Similar approach | What it helps with | DeukAgentRules adds |
56
+ |---|---|---|
57
+ | `AGENTS.md` open format | A predictable instruction file for coding agents | Ticket lifecycle, phase gates, verification, and archiveable memory |
58
+ | Copilot instructions / Cursor rules / Claude memory | Tool-specific guidance | One repo-owned workflow shared across agent clients |
59
+ | Claude or Copilot custom agents and skills | Reusable task playbooks | Skills route into scoped, ticketed execution instead of replacing the workflow |
60
+ | Agent launchers and harnesses | Running many coding agents from one place | Lifecycle control inside the repository, independent of the chosen agent |
61
+ | General LLM/MCP guardrails | Runtime policy checks for AI systems | Developer-facing work orders, scope contracts, Git-visible history, and closeout evidence |
55
62
 
56
- Upon initialization, interactive questions will ask for the project's **tech stack** and **agent tools in use**. Based on your selections, optimized markdown templates and rule files (`.cursor/rules/*`) will be automatically generated and synchronized.
57
- - If you don't need to change the tech stack later, simply run `deuk-agent-rule init` to refresh the rules. (If not installed globally, you can fallback to `npx deuk-agent-rule init`).
58
- - Suppress interactive prompts in CI or script environments by appending the `--non-interactive` flag.
63
+ Use DeukAgentRules when you want AI coding work to stay coordinated, reviewable, and easy to carry forward across sessions and teammates.
59
64
 
60
- ### πŸ”„ Updating the Rules Package
61
- When a new version of the agent rules or templates is released, you can sync the latest instructions to your project by updating the package and re-running `init`.
62
- Since your previous configurations are saved (`.deuk-agent-rule.config.json`), using the `--non-interactive` flag will quietly and cleanly overwrite the obsolete rules with the latest ones without asking any questions.
63
- ```bash
64
- npm install deuk-agent-rule@latest
65
- deuk-agent-rule init --non-interactive
66
- ```
65
+ ### Better Together With Karpathy-Style Skills
67
66
 
68
- > [!TIP]
69
- > **πŸ’‘ Troubleshooting: Legacy Version Migration Failures**
70
- > If you are migrating from a very old version and `init` repeatedly fails due to corrupted configurations or heavily modified template structures, the fastest fix is to perform a clean initialization using the `--clean` flag. **(This will not affect your existing tickets.)**
71
- > ```bash
72
- > deuk-agent-rule init --clean --interactive
73
- > ```
67
+ Karpathy-style skills are great at improving how an agent behaves inside a task. DeukAgentRules is great at making that task ticketed, scoped, verified, and remembered at the repository level.
74
68
 
75
- ---
69
+ Used together, skills can improve the quality of the move, while DeukAgentRules keeps the move connected to team workflow. The result is a better session and a better project record: behavior playbooks on the front end, ticket lifecycle and DeukAgentContext memory on the back end.
76
70
 
77
- ## 🎯 The Ticket Workflow
78
-
79
- Running `deuk-agent-rule init` deploys a **zero-touch scaffolding sandbox** at your workspace root, spawning two essential directories:
80
-
81
- 1. **`.deuk-agent-templates/` (Agent Templates)**: Houses the official blueprint (`TICKET_TEMPLATE.md`) dictating how AIs must process and report tasks. Committed alongside your source code to serve as the team's rulebook.
82
- 2. **`.deuk-agent-ticket/` (Ticket Execution Space)**: The covert space where volatile instructions (`TICKET-XXX.md`) are exchanged between agents and workers. (Automatically hidden by `.gitignore` to prevent security leaks and repository bloat).
83
-
84
- ### πŸ’‘ Workflow Overview
85
- ```mermaid
86
- %%{init: {"flowchart": {"htmlLabels": false}, "themeCSS": ".node text { fill: #ffffff !important; stroke: none !important; }"} }%%
87
- graph TD
88
- classDef action fill:#2563eb,stroke:#1d4ed8,stroke-width:2px,color:#ffffff;
89
- classDef phase fill:#475569,stroke:#334155,stroke-width:2px,color:#ffffff;
90
- classDef decision fill:#d97706,stroke:#b45309,stroke-width:2px,color:#ffffff;
91
- classDef highlight fill:#dc2626,stroke:#b91c1c,stroke-width:2px,color:#ffffff;
92
-
93
- A(Step 1: Ticket Creation):::action --> B(Step 2: Agent Execution):::phase
94
- B --> C(Step 3: Verification & Closure):::phase
95
-
96
- C --> D{Issues Found?}:::decision
97
-
98
- D -->|Yes| E(MANDATORY Follow-up Chaining):::highlight
99
- E --> F(Step 4: Archiving):::action
100
- D -->|No| F
101
- ```
71
+ ### What's Next
102
72
 
103
- The optimal **4-Step AI Coding Sequence** utilizing these sandbox folders is as follows.
73
+ The next step is to make this workflow even easier to see and adopt: clearer first-run checks, compact CLI/RAG reminders for agents, stronger README/npm positioning, and companion surfaces that show active ticket, phase, open-ticket count, and DeukAgentContext memory status without asking teams to switch coding agents.
104
74
 
105
- ### [Step 1] Ticket Creation & Submodule Isolation
106
- Do not issue scattered, unbounded commands to your AI. Narrowing the **context** via a clear ticket is strictly required to prevent astronomical costs and accidental code corruption.
75
+ ### πŸ“š Detailed Documentation
76
+ | Doc | Purpose |
77
+ |---|---|
78
+ | [docs/architecture.md](docs/architecture.md) | High-level system structure and visual infographics |
79
+ | [docs/how-it-works.md](docs/how-it-works.md) | Detailed CLI mechanics, initialization lifecycle, and file roles |
80
+ | [docs/principles.md](docs/principles.md) | Design philosophy: Hub-Spoke, Zero-Legacy, and Source Sovereignty |
81
+ | [docs/product-positioning-research.ko.md](docs/product-positioning-research.ko.md) | Product positioning research for AI coding agent guardrails |
82
+ | [docs/karpathy-skills-vs-deukagent-positioning.ko.md](docs/karpathy-skills-vs-deukagent-positioning.ko.md) | Deep comparison of Karpathy-style skills, DeukAgentRules, and DeukAgentContext |
83
+ | [docs/vision-agent-guardrails.ko.md](docs/vision-agent-guardrails.ko.md) | Vision document for the multi-agent guardrail hub |
84
+ | [docs/organic-growth-plan.ko.md](docs/organic-growth-plan.ko.md) | Organic growth plan for VS Code, Open VSX, GitHub, and skill loops |
85
+ | **Korean Docs** | [README.ko.md](README.ko.md) Β· [docs/architecture.ko.md](docs/architecture.ko.md) |
107
86
 
108
- ```bash
109
- deuk-agent-rule ticket create --topic ui-refactoring --group frontend --project DeukUI
110
- ```
111
- This command instantly creates a templated `TICKET-ui-refactoring.md` file within the `.deuk-agent-ticket/` directory.
87
+ ---
112
88
 
113
- > [!IMPORTANT]
114
- > **Filling the Ticket (CRITICAL)**: The newly created ticket already contains **YAML Front Matter** (`--- id: ... ---`). **DO NOT** overwrite the entire file when adding your plan. ALWAYS append your content below the header or use partial file editing to preserve the existing YAML metadata. Erasing the Front Matter corrupts the ticketing system.
89
+ ## πŸ› οΈ Installation & Setup
115
90
 
116
- The developer must simply specify the exact isolated directory path (e.g., `src/client`) inside the `[Target Submodule]` attribute at the top of the generated file.
91
+ ### 1. Global Installation (Standard User)
92
+ To prevent `npx` cache issues and "Local Traps", a global installation is strictly required.
117
93
 
118
- ### [Step 2] Agent Execution & Handoff (Ticket Session)
119
- Provide a single line of instruction to your AI chatbot (Cursor, Gemini, etc.):
120
- > *"Open the recently issued `.deuk-agent-ticket/TICKET-ui-refactoring.md` ticket and strictly follow the checklist within the specified target submodule."*
94
+ ```bash
95
+ npm install -g deuk-agent-rule
96
+ deuk-agent-rule init
97
+ ```
121
98
 
122
- The AI will faithfully read the defined Phases in the ticket and write optimized code while **completely blocking out unnecessary computations for unrelated server logic or sibling modules**. (This mechanism drastically reduces token costs).
99
+ ### 2. Local Source Development (Maintainer/Power User)
100
+ v3.0 introduces a **Global CLI Proxy**. If you are developing inside the `DeukAgentRules` workspace, the global command will automatically delegate execution to your local source.
123
101
 
124
- ### [Step 3] Status Review & Closure
125
- As the AI writes the code, it will simultaneously update the markup checkboxes (`[x]`) inside the ticket. If the agent's session memory limit is approaching, simply leave the ticket file saved, turn off the chat window, open a fresh session, and issue [Step 2] again. The handoff (session transfer) is seamlessly completed.
126
- Once all steps are accomplished, promote the Phase status to `[Phase Complete]`. Instead of manually typing terminal commands, **you can simply tell your AI chatbot via natural language prompt: "Show me the list of active tickets" or "Archive the completed tickets with reports"**, and the AI will autonomously invoke the CLI to manage them for you.
127
102
  ```bash
128
- deuk-agent-rule ticket list
129
- ```
130
- ```text
131
- # STATUS SUBMODULE GROUP PROJECT CREATED TITLE
132
- 1 [ ] DeukPack sub global 2026-04-18T13:34:32.484Z naming-consistency
103
+ cd ~/workspace/DeukAgentRules
104
+ sudo npm link
105
+ deuk-agent-rule init # Routes to local scripts/cli.mjs automatically
133
106
  ```
134
107
 
135
- ### [Step 4] Ticket Verification (Self-Correction)
136
- After all phases are marked as `[x]`, you should issue a final command to the AI:
137
- > *"Proceed with **Ticket Verification** for this task."*
108
+ If you primarily work in Codex or Copilot, this is the recommended day-to-day setup. Those clients currently have the smoothest behavior with the hub-spoke and ticket-driven workflow.
138
109
 
139
- The AI, following the strictly defined **[TICKET VERIFICATION RULE]** in `AGENTS.md`, will then autonomously perform a 3-stage audit:
140
- 1. **Side Effect Analysis**: Detecting potential build warnings or broken dependencies.
141
- 2. **Convention Audit**: Re-verifying if filenames and classes perfectly match project architecture documents.
142
- 3. **Potential Issue Reporting**: Listing breaking changes or unverified edge cases (e.g., native build constraints).
110
+ ---
143
111
 
144
- This final step ensures that the agent's output is not just "functional" but "production-grade" and architecturally sound.
112
+ ## 🎯 The Protocol Workflow
145
113
 
146
- ---
114
+ The workflow is governed by a **Ticket-Driven Execution Contract**.
147
115
 
148
- ## πŸ€– AI Agent Prompting Guide
116
+ 1. **Scaffolding**: `init` deploys `.deuk-agent/templates/` and `AGENTS.md` (or local pointers like `PROJECT_RULE.md`).
117
+ 2. **Ticketing (Plan Phase)**: `ticket create --topic feature-x` generates a bounded work order in `.deuk-agent/tickets/`. During this phase, agents operate in **Plan Mode** and are restricted from mutating files.
118
+ 3. **Execution (Execute Phase)**: Once authorized, the AI agent reads the ticket, locks onto the **Target Submodule**, and executes code changes. MCP Soft Gates ensure that unauthorized modifications are blocked.
119
+ 4. **Verification**: The agent performs a side-effect audit and convention (e.g., DC-DUP) check before closure.
120
+ 5. **Archiving (Archive Phase)**: Completed tickets undergo Zero-Token Knowledge Distillation and move to `reports/` to build the **Engineering Memory Engine** via DeukAgentContext.
149
121
 
150
- Even after installing and initializing the package, some AI agents (Cursor, Gemini, etc.) might not actively read the rule file (`AGENTS.md`) in a fresh session. **Whenever you start a new chat session, copy and paste the following prompts to force the AI to align with the rules. This effectively eliminates hallucination and accidental scope-creep.**
122
+ ---
123
+
124
+ ## βš™οΈ CLI Reference
151
125
 
152
- ### 1. Force Rule Familiarization (Mandatory)
153
- > *"Before starting any work, please read the `AGENTS.md` (DeukAgentRules) file at the workspace root from top to bottom. Make sure you fully understand your Identity, the core project rules, and the ticket workflow. Once you have read and understood them, do NOT summarize them; simply reply 'Rules Acknowledged' and await my first instruction."*
126
+ Delegate these to your AI agent via natural language prompts!
154
127
 
155
- ### 2. Ticket Execution (Recommended)
156
- > *"Open the recently issued `.deuk-agent-ticket/TICKET-XXX.md` ticket. Restrict all your file exploration, analysis, and modifications STRICTLY to the target submodule path explicitly specified in the ticket. Do not wander into other submodules or accidentally modify unrelated files."*
128
+ | Command | Description / Example Prompt |
129
+ |--------|------|
130
+ | `deuk-agent-rule init` | Synchronizes the rule Hub and Spoke pointers. <br>πŸ’¬ *"Initialize project rules"* |
131
+ | `deuk-agent-rule ticket create` | Issues a new execution contract. Use `--summary` plus `--plan-body` for a one-pass Phase 1 ticket. <br>πŸ’¬ *"Create ticket: refactor-ui with filled APC"* |
132
+ | `deuk-agent-rule ticket list` | Displays active work orders. <br>πŸ’¬ *"Show active tickets"* |
133
+ | `deuk-agent-rule ticket archive` | Securely stores completed work. <br>πŸ’¬ *"Archive ticket 068"* |
134
+ | `deuk-agent-rule skill list` | Shows first-party thin skills such as `safe-refactor`, `generated-file-guard`, and `context-recall`. |
135
+ | `deuk-agent-rule skill add --skill safe-refactor` | Installs a skill into the local registry without changing the TDW/APC authority model. |
136
+ | `deuk-agent-rule skill expose --platform claude` | Exposes installed skills as platform-specific thin wrappers. Supported MVP platforms: `claude`, `cursor`. |
137
+ | `deuk-agent-rule skill lint` | Audits skill files for duplicate workflow contracts and unsafe generated-file guidance. |
138
+
139
+ ### Ticket File Git Hygiene
140
+
141
+ - Treat `.deuk-agent/tickets/**/*.md` and `INDEX*.json` as CLI-managed lifecycle artifacts.
142
+ - Do not commit a ticket body without the related index updates. The next session can restore the wrong active/archive state.
143
+ - After `ticket create` fails, do not create or repair ticket files manually.
144
+ - Do not flip ticket status by editing frontmatter directly. Use `ticket move`, `ticket close`, or `ticket archive`.
145
+ - `telemetry.jsonl` is usually operational log noise, so it is better left out of normal code commits unless your repo intentionally tracks it.
146
+ - When possible, commit completed work after `ticket archive` so the active/archive transition lands in one history step.
147
+
148
+ For more day-to-day examples, see [docs/how-it-works.md](docs/how-it-works.md).
157
149
 
158
150
  ---
159
151
 
160
- ## βš™οΈ CLI Reference & Advanced Options
152
+ ## Related Ideas & Inspiration
161
153
 
162
- Advanced commands for workflow automation and target control.
154
+ DeukAgentRules shares the same concern as guideline-first projects like
155
+ [andrej-karpathy-skills](https://github.com/forrestchang/andrej-karpathy-skills):
156
+ AI coding agents often over-assume, over-engineer, and edit outside the requested scope.
163
157
 
164
- > [!NOTE]
165
- > **For Package Maintainers/Contributors Only - Local Development**:
166
- > This does not apply to general users. If you are modifying the `DeukAgentRules` source code and need to immediately test local patches bypassing the globally cached `npx deuk-agent-rule`, explicitly invoke `node ./scripts/cli.mjs`.
167
- > - **Linux/macOS**: Creating symlinks (`npm link`) may require `sudo` privileges. Direct script execution (`./scripts/cli.mjs`) may trigger `chmod +x` permission issues, making explicit `node` invocation the safest workaround.
168
- > - **Windows**: `npm link` requires Administrator rights (or Developer Mode) to create symlinks, and PowerShell execution policies may block `.cmd` wrapper scripts. Explicitly calling `node ./scripts/cli.mjs` safely bypasses these OS-level restrictions.
158
+ Where prompt-level guideline files improve agent behavior inside one client,
159
+ DeukAgentRules adds a repository-level workflow layer: tickets, phase gates,
160
+ scoped permissions, verification, and archiveable engineering memory.
169
161
 
170
- ### Ticket-based Commands
171
- Instead of manually typing the CLI commands below into the terminal, you can **delegate their execution to your AI chatbot by giving natural language prompt instructions**.
162
+ The first-party skill MVP keeps that boundary explicit: skills are short
163
+ `SKILL.md` playbooks for recurring failure patterns, while `core-rules/AGENTS.md`
164
+ remains the workflow authority. Use `skill add` and `skill expose` to make those
165
+ playbooks visible to Claude or Cursor without copying the full rule contract.
172
166
 
173
- | Command | Description / Natural Language Prompt Example |
174
- |--------|------|
175
- | `deuk-agent-rule ticket create ...` | Generates a new ticket document (accepts `--group`, `--project`, `--submodule`) <br>πŸ’¬ *"Create new ticket (topic: refactor)"* |
176
- | `deuk-agent-rule ticket list` | Lists and displays active tickets (`--archived`, `--all`, `--json` supported) <br>πŸ’¬ *"Ticket list"* |
177
- | `deuk-agent-rule ticket use --latest ...` | Returns only the file path of the most recent ticket <br>πŸ’¬ *"Recent ticket path"* |
178
- | `deuk-agent-rule ticket close ...` | Soft-closes a target ticket by locking its status to completed without moving the file <br>πŸ’¬ *"Close this ticket"* |
179
- | `deuk-agent-rule ticket upgrade` | Migrates legacy ticket structures to V2 (YAML FM) and triggers submodule DEFRAG <br>πŸ’¬ *"Upgrade tickets to v2"* |
180
- | `deuk-agent-rule ticket archive ...` | Securely moves completed tickets to `archive/` and updates INDEX <br>πŸ’¬ *"Archive this ticket (attach report)"* |
181
- | `deuk-agent-rule ticket reports` | Lists structurally preserved agent work reports (`reports/`) <br>πŸ’¬ *"List archived reports"* |
182
-
183
- ### Advanced Init Options
184
- | Flag | Default | Description |
185
- |--------|--------|------|
186
- | `--non-interactive` | Off | For CI/Scripts. Disables interactive UI and adopts existing `.config.json` |
187
- | `--interactive` | Off | Forces the interactive setup to reappear even if config already exists |
188
- | `--clean` | Off | Deletes legacy templates and configs before initializing |
189
- | `--cwd <path>` | Current dir | Adjust target workspace root (absolute/relative path) |
190
- | `--dry-run` | Off | Simulates the execution text in the console without generating/altering files |
191
- | `--backup` | Off | Safely creates `*.bak` copies of `AGENTS.md` and rule files before overwriting |
192
-
193
- ## πŸ“¦ Release & Changelog Policy
194
-
195
- Before pushing any core updates, system templates, or feature changes to this package (`DeukAgentRules`), you must strictly follow this procedure to bump the version safely:
196
-
197
- 1. **Apply Changes**: Complete documentation and rule script updates, then `git add` and `git commit` (Conventional Commits format recommended, e.g., `feat: ...`, `fix: ...`).
198
- 2. **Version Bump & Automated Changelog**:
199
- * Patch (Bug fixes): `npm run bump:patch`
200
- * Minor (New features): `npm run bump:minor`
201
- * Major (Core/Breaking changes): `npm run bump:major`
202
-
203
- Executing the bump command will trigger the `commit-and-tag-version` pipeline: it bumps the version in `package.json`, auto-generates the `CHANGELOG.md` log, creates a release commit, and applies the release tag.
204
- 3. **Synchronize & Mirror (OSS Sync)**: As a final step, ask your agent to run `npm run sync:oss`. The automation script will clean the release assets and push the bundled versions to the mirror repository (`DeukAgentRulesOSS`).
167
+ ```bash
168
+ npx deuk-agent-rule init
169
+ npx deuk-agent-rule skill list
170
+ npx deuk-agent-rule skill add --skill safe-refactor
171
+ npx deuk-agent-rule skill expose --platform claude
172
+ ```
205
173
 
206
174
  ---
207
175
 
208
- ### 🏷️ Keywords for NPM & GitHub Search
209
- `#cursorrules` `#copilot-instructions` `#ai-agents` `#deuk-agent` `#mcp` `#rag` `#windsurf` `#cline` `#llm-workflow` `#productivity` `#prompt-engineering` `#developer-tools`
176
+ ### 🏷️ Keywords
177
+ `#AI-Orchestration` `#Agentic-Workflow` `#DeukFamily` `#Engineering-Intelligence` `#Zero-Legacy` `#High-Signal-Coding` `#AI-Protocol` `#CursorRules` `#CopilotInstructions` `#ClaudeCode` `#ClaudeMD` `#AgentsMD` `#AgentSkills` `#CodingAgent` `#AI-Guardrails` `#LLM-Control-Plane`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "deuk-agent-rule",
3
- "version": "2.5.14",
4
- "description": "DeukAgentRules: generic AGENTS.md + .cursor rule templates with init/merge CLI (npm name: deuk-agent-rule).",
3
+ "version": "3.3.2",
4
+ "description": "AI coding agent guardrails for every repo: ticketed scope, verification, and shared AGENTS.md workflows.",
5
5
  "keywords": [
6
6
  "agents-md",
7
7
  "cursor-rules",
@@ -11,6 +11,8 @@
11
11
  "windsurf",
12
12
  "jetbrains",
13
13
  "ticket",
14
+ "ai-guardrails",
15
+ "agent-guardrails",
14
16
  "deuk-family",
15
17
  "deukpack-ecosystem"
16
18
  ],
@@ -25,21 +27,41 @@
25
27
  "homepage": "https://github.com/joygram/DeukAgentRules#readme",
26
28
  "files": [
27
29
  "LICENSE",
28
- "bundle/**/*",
29
- "scripts/**/*.mjs",
30
+ "bin/**/*",
31
+ "templates/**/*",
32
+ "scripts/cli.mjs",
33
+ "scripts/cli-args.mjs",
34
+ "scripts/cli-init-commands.mjs",
35
+ "scripts/cli-init-logic.mjs",
36
+ "scripts/cli-prompts.mjs",
37
+ "scripts/cli-rule-compiler.mjs",
38
+ "scripts/cli-skill-commands.mjs",
39
+ "scripts/cli-telemetry-commands.mjs",
40
+ "scripts/cli-ticket-commands.mjs",
41
+ "scripts/cli-ticket-index.mjs",
42
+ "scripts/cli-ticket-migration.mjs",
43
+ "scripts/cli-ticket-parser.mjs",
44
+ "scripts/cli-utils.mjs",
45
+ "scripts/lint-md.mjs",
46
+ "scripts/lint-rules.mjs",
47
+ "scripts/merge-logic.mjs",
48
+ "scripts/plan-parser.mjs",
30
49
  "README.md",
31
50
  "README.ko.md",
32
51
  "CHANGELOG.md",
33
52
  "CHANGELOG.ko.md"
34
53
  ],
35
54
  "scripts": {
36
- "sync": "node scripts/sync-bundle.mjs",
37
- "prepack": "node scripts/sync-bundle.mjs"
55
+ "lint:md": "node scripts/lint-md.mjs",
56
+ "test": "node --test scripts/tests/*.test.mjs"
38
57
  },
39
58
  "engines": {
40
59
  "node": ">=18"
41
60
  },
42
- "bin": {},
61
+ "bin": {
62
+ "deuk-agent-rule": "./bin/deuk-agent-rule.js",
63
+ "deukagentrule": "./bin/deuk-agent-rule.js"
64
+ },
43
65
  "dependencies": {
44
66
  "ejs": "^5.0.2",
45
67
  "yaml": "^2.8.3"
@@ -5,15 +5,16 @@ export function parseTicketArgs(argv) {
5
5
  if (a === "--cwd") out.cwd = argv[++i];
6
6
  else if (a === "--dry-run") out.dryRun = true;
7
7
  else if (a === "--non-interactive") out.nonInteractive = true;
8
- else if (a === "--topic") out.topic = argv[++i];
8
+ else if (a === "--topic" || a === "--id") out.topic = argv[++i];
9
9
  else if (a === "--group") out.group = argv[++i];
10
10
  else if (a === "--project") out.project = argv[++i];
11
11
  else if (a === "--content") out.content = argv[++i];
12
12
  else if (a === "--from") out.from = argv[++i];
13
+ else if (a === "--plan-body") out.planBody = argv[++i];
13
14
  else if (a === "--ref") out.ref = argv[++i];
14
15
  else if (a === "--limit") out.limit = Number(argv[++i]);
15
16
  else if (a === "--submodule") out.submodule = argv[++i];
16
- else if (a === "--latest") out.latest = true;
17
+ else if (a === "--latest" || a === "-l") out.latest = true;
17
18
  else if (a === "--path-only") out.pathOnly = true;
18
19
  else if (a === "--print-content") out.printContent = true;
19
20
  else if (a === "--all") out.all = true;
@@ -25,6 +26,22 @@ export function parseTicketArgs(argv) {
25
26
  else if (a === "--remote") out.remote = argv[++i];
26
27
  else if (a === "--sync") out.sync = true;
27
28
  else if (a === "--no-sync") out.sync = false;
29
+ else if (a === "--chain") out.chain = true;
30
+ else if (a === "--render") out.render = true;
31
+ else if (a === "--docs-language") out.docsLanguage = argv[++i];
32
+ else if (a === "--evidence") out.evidence = argv[++i];
33
+ else if (a === "--skip-phase0") out.skipPhase0 = true;
34
+ else if (a === "--summary") out.summary = argv[++i];
35
+ else if (a === "--tags") out.tags = argv[++i];
36
+ else if (a === "--phase") out.phase = Number(argv[++i]);
37
+ else if (a === "--next") out.next = true;
38
+ else if (a === "--handoff") out.handoff = true;
39
+ else if (a === "--reason") out.reason = argv[++i];
40
+ else if (a === "--claim") out.claim = argv[++i];
41
+ else if (a === "--require-filled") out.requireFilled = true;
42
+ else if (a === "--allow-placeholder") out.allowPlaceholder = true;
43
+ else if (a === "--compact") out.compact = true;
44
+ else if (a === "--status-detail") out.statusDetail = true;
28
45
  }
29
46
  return out;
30
47
  }
@@ -43,14 +60,81 @@ export function parseArgs(argv) {
43
60
  else if (a === "--marker-begin") out.markerBegin = argv[++i];
44
61
  else if (a === "--marker-end") out.markerEnd = argv[++i];
45
62
  else if (a === "--agents") out.agents = argv[++i];
46
- else if (a === "--rules") out.rules = argv[++i];
47
63
  else if (a === "--cursorrules") out.cursorrules = argv[++i];
48
64
  else if (a === "--append-if-no-markers") out.appendIfNoMarkers = true;
65
+ else if (a === "--workflow") out.workflowMode = argv[++i];
66
+ else if (a === "--approval") out.approval = argv[++i];
49
67
  else if (a === "--json") out.json = true;
50
68
  else if (a === "--remote") out.remote = argv[++i];
51
69
  else if (a === "--sync") out.sync = true;
52
70
  else if (a === "--no-sync") out.sync = false;
71
+ else if (a === "--docs-language") out.docsLanguage = argv[++i];
72
+ else if (a === "--compact") out.compact = true;
53
73
  else if (a === "-h" || a === "--help") out.help = true;
54
74
  }
55
75
  return out;
56
76
  }
77
+
78
+ export function parseSkillArgs(argv) {
79
+ const out = { cwd: process.cwd(), dryRun: false, nonInteractive: false };
80
+ for (let i = 0; i < argv.length; i++) {
81
+ const a = argv[i];
82
+ if (a === "--cwd") out.cwd = argv[++i];
83
+ else if (a === "--dry-run") out.dryRun = true;
84
+ else if (a === "--non-interactive") out.nonInteractive = true;
85
+ else if (a === "--skill" || a === "--id") out.skill = argv[++i];
86
+ else if (a === "--platform") out.platform = argv[++i];
87
+ else if (a === "--json") out.json = true;
88
+ }
89
+ return out;
90
+ }
91
+ export function parseTelemetryArgs(argv) {
92
+ const out = {
93
+ cwd: process.cwd(),
94
+ tokens: 0,
95
+ tdw: 0,
96
+ model: "",
97
+ client: "",
98
+ ticket: "",
99
+ action: "",
100
+ file: "",
101
+ remote: "",
102
+ source: "",
103
+ kind: "",
104
+ event: "",
105
+ occurredAt: "",
106
+ phase: "",
107
+ status: "",
108
+ ragResult: "",
109
+ localFallback: false,
110
+ knowledgeAction: "",
111
+ tokenQuality: "",
112
+ savedTokens: 0,
113
+ json: false
114
+ };
115
+ for (let i = 0; i < argv.length; i++) {
116
+ const a = argv[i];
117
+ if (a === "--cwd") out.cwd = argv[++i];
118
+ else if (a === "--tokens") out.tokens = Number(argv[++i]);
119
+ else if (a === "--tdw") out.tdw = Number(argv[++i]);
120
+ else if (a === "--model") out.model = argv[++i];
121
+ else if (a === "--client") out.client = argv[++i];
122
+ else if (a === "--ticket") out.ticket = argv[++i];
123
+ else if (a === "--action") out.action = argv[++i];
124
+ else if (a === "--file") out.file = argv[++i];
125
+ else if (a === "--remote") out.remote = argv[++i];
126
+ else if (a === "--source") out.source = argv[++i];
127
+ else if (a === "--kind") out.kind = argv[++i];
128
+ else if (a === "--event") out.event = argv[++i];
129
+ else if (a === "--occurred-at") out.occurredAt = argv[++i];
130
+ else if (a === "--phase") out.phase = Number(argv[++i]);
131
+ else if (a === "--status") out.status = argv[++i];
132
+ else if (a === "--rag-result") out.ragResult = argv[++i];
133
+ else if (a === "--local-fallback") out.localFallback = true;
134
+ else if (a === "--knowledge-action") out.knowledgeAction = argv[++i];
135
+ else if (a === "--token-quality") out.tokenQuality = argv[++i];
136
+ else if (a === "--saved-tokens") out.savedTokens = Number(argv[++i]);
137
+ else if (a === "--json") out.json = true;
138
+ }
139
+ return out;
140
+ }