apt-mcp-agent-setup 2.0.1 → 3.0.1
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/bin/cli.js +1 -1
- package/bundle/NOTICES.md +0 -0
- package/bundle/core.enc +0 -0
- package/bundle/mcp-rules.enc +0 -0
- package/bundle/skills-aso.enc +0 -0
- package/bundle/skills-ba.enc +0 -0
- package/bundle/skills-base.enc +0 -0
- package/bundle/skills-be.enc +0 -0
- package/bundle/skills-design.enc +0 -0
- package/bundle/skills-fe.enc +0 -0
- package/bundle/skills-mobile.enc +0 -0
- package/bundle/skills-pm.enc +0 -0
- package/integrity-manifest.json +63 -17
- package/package.json +1 -1
- package/src/core/catalog.js +1 -0
- package/src/core/context-metrics.js +1 -0
- package/src/core/doctor.js +1 -0
- package/src/core/execution.js +1 -0
- package/src/core/hook-bridge.js +1 -0
- package/src/core/host-adapters.js +1 -0
- package/src/core/memory-store.js +1 -0
- package/src/core/model-routing.js +1 -0
- package/src/core/owned-lock.js +1 -0
- package/src/core/session.js +1 -0
- package/src/core/skill-names.js +1 -0
- package/src/installer/context-legacy-hashes.json +42 -0
- package/src/installer/global-setup.js +1 -1
- package/src/installer/host-hooks.js +1 -0
- package/src/installer/managed-config.js +1 -0
- package/src/installer/platform-config.js +1 -1
- package/src/installer/prerequisites.js +1 -1
- package/src/installer/project-setup.js +1 -1
- package/src/installer/runtime-launcher.js +1 -0
- package/src/installer/runtime-lock.js +1 -0
- package/src/installer/runtime-store.js +1 -0
- package/src/installer/setup-wizard.js +1 -1
- package/src/license/crypto.js +1 -1
- package/src/license/fingerprint.js +1 -1
- package/src/license/terms.js +1 -1
- package/src/license/verify.js +1 -1
- package/src/presets/index.js +1 -1
- package/src/proxy/backends.js +1 -1
- package/src/proxy/core-tools.js +1 -0
- package/src/proxy/pipeline.js +1 -1
- package/src/proxy/router.config.js +1 -1
- package/src/proxy/router.js +1 -1
- package/src/proxy/server.js +1 -1
- package/src/templates/AGENTS.md +13 -181
- package/src/templates/CLAUDE.md +7 -248
- package/src/templates/GEMINI.md +12 -293
- package/src/templates/apt-runtime.md +16 -0
- package/src/templates/copilot-instructions.md +7 -208
- package/src/templates/cursorrules.mdc +8 -222
- package/src/templates/mcp-tools.md +176 -175
- package/src/templates/windsurfrules.md +7 -208
|
@@ -1,214 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# APT workspace contract
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
At session start and after context recovery, call `session_bootstrap` for this workspace and read `docs/agents/apt-runtime.md` once per context. Read project conventions in `.agents/memory/MEMORY.md`; retrieve only relevant dynamic memory. Report unavailable backends once and use available fallbacks.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For new or changed intent, call `route_request` with the target, stack and explicit skills. Use `skill_load` for selected skills and current-step references. Do not load the full trigger catalog or repeat rules on every tool call.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Before code changes, bind `pipeline_status` and `pipeline_start` or `pipeline_use` to an explicit task, runId and workspace. Reserve with `pipeline_next`; verify and checkpoint current code before completion. Read-only questions, review and existing tests need no code-change pipeline. Clarify only unresolved decisions.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Use at most four actors including the coordinator and one writer per workspace. Respect host permissions, Plan Mode and user stops. Never claim independent review or native enforcement without observed capability. Keep attempts and evidence across resume; do not reset exhausted budgets.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Preserve custom files. Write concise code and prose, run suitable checks, and review staged, unstaged and relevant new files. Publishing, merging and external messages require authorization. Strong caveman style is opt-in.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Triage labels
|
|
16
|
-
|
|
17
|
-
Default label vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See `docs/agents/triage-labels.md`.
|
|
18
|
-
|
|
19
|
-
### Domain docs
|
|
20
|
-
|
|
21
|
-
Single-context layout — one `CONTEXT.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## ⛔ CRITICAL: apt-mcp-agent TOOL USAGE (P0 — READ FIRST)
|
|
26
|
-
|
|
27
|
-
**You have `apt-mcp-agent` MCP tools available. You MUST use them:**
|
|
28
|
-
- **Before ANY code search**: use `explore_code` or `code_search` — NOT grep_search for code symbols
|
|
29
|
-
- **Before executable changes**: call `pipeline_status`, then `pipeline_start` or `pipeline_use`
|
|
30
|
-
- **After each pipeline step**: call `pipeline_checkpoint` with required `task` and `runId`
|
|
31
|
-
- **Session start**: call `read_knowledge` + `pipeline_status`
|
|
32
|
-
|
|
33
|
-
Ignoring these tools and using only built-in IDE tools is a **P0 protocol violation**.
|
|
34
|
-
|
|
35
|
-
## Session Start Protocol (MANDATORY)
|
|
36
|
-
|
|
37
|
-
At the start of every session:
|
|
38
|
-
1. Read `.agents/ARCHITECTURE.md` to understand Agents, Skills, and Scripts.
|
|
39
|
-
2. Read `.agents/memory/MEMORY.md` to load persistent project conventions, user preferences, and tech decisions.
|
|
40
|
-
3. Read `docs/agents/mcp-tools.md` to load MCP tool selection rules & memory conventions.
|
|
41
|
-
4. Call `read_knowledge` to load dynamic knowledge graph from memory.
|
|
42
|
-
5. **Read `.agents/skill-triggers.json` to load auto-routing rules for all skills/workflows/tools.**
|
|
43
|
-
|
|
44
|
-
### 🔄 Context Recovery (MANDATORY after any context truncation/compression)
|
|
45
|
-
If your conversation context was truncated, compressed, or you are resuming after a checkpoint:
|
|
46
|
-
1. **Call `pipeline_status()` immediately** — it returns recovery instructions and tool reminders
|
|
47
|
-
2. Re-read the session start files above if not already in context
|
|
48
|
-
3. Classify the current user request before taking any code action
|
|
49
|
-
|
|
50
|
-
### ⚠️ MCP TOOL ACCESSIBILITY & FALLBACK WARNING (CRITICAL)
|
|
51
|
-
If the specialized MCP tool `code_search` or other core MCP tools (e.g., `recall`, `remember`, `impact_analysis`) are not in your available tools list:
|
|
52
|
-
- **DO NOT silently fall back to basic text search or skip debugging workflows.**
|
|
53
|
-
- **STOP immediately, warn the user** that the `apt-mcp-agent` server did not start successfully or has been disabled in the IDE settings, and recommend they run `npx apt-mcp-agent-setup status` to check their setup.
|
|
54
|
-
- Only proceed with fallback tools (e.g. `grep_search`) if the user explicitly approves it.
|
|
55
|
-
|
|
56
|
-
### 🛠️ ENFORCED DEVELOPER PIPELINES (MANDATORY — MCP TOOL GATE)
|
|
57
|
-
|
|
58
|
-
Before writing any code or implementing features, you MUST follow one of the three enforced pipelines below.
|
|
59
|
-
**Start or bind a run with `pipeline_start(pipeline, task, workspace)` or `pipeline_use(task, runId)`.**
|
|
60
|
-
**After each step call `pipeline_checkpoint(task, runId, step, status="completed", summary)`.**
|
|
61
|
-
|
|
62
|
-
Content-only documentation changes that do not affect executable behavior are exempt from PRD, issue, and TDD pipeline steps. Agent contracts such as `AGENTS.md`, `SKILL.md`, trigger maps, pipeline definitions, and runtime configuration are operational and are not exempt.
|
|
63
|
-
Skipping steps or executing out-of-order is a **P0 protocol violation** — the tool will REJECT invalid transitions.
|
|
64
|
-
|
|
65
|
-
#### 🚀 Feature Development Pipeline (5 steps — NO EXCEPTIONS, NO SKIP)
|
|
66
|
-
```
|
|
67
|
-
/grill-me → /to-prd → /to-issues → /tdd → /improve-codebase-architecture
|
|
68
|
-
```
|
|
69
|
-
1. **`/grill-me`** → Stress-test the plan/design with relentless Socratic questions. Challenge edge cases, security, performance.
|
|
70
|
-
2. **`/to-prd`** → Synthesize the grill-me session and conversation context into a formal PRD document.
|
|
71
|
-
3. **`/to-issues`** → Break PRD into vertical-slice issues on the issue tracker. Create `{task-slug}.md` for tracking.
|
|
72
|
-
4. **`/tdd`** → Implement code test-first using RED-GREEN-REFACTOR cycle.
|
|
73
|
-
5. **`/improve-codebase-architecture`** → Review and deepen architecture. Generate HTML report + grill-me session on codebase quality.
|
|
74
|
-
|
|
75
|
-
#### 🐛 Bug Fix Pipeline (5 steps — NO EXCEPTIONS, NO SKIP)
|
|
76
|
-
```
|
|
77
|
-
/diagnose → /grill-me → /to-prd → /to-issues → /tdd
|
|
78
|
-
```
|
|
79
|
-
1. **`/diagnose`** → Build feedback loop: reproduce → minimize → hypothesize → fix.
|
|
80
|
-
2. **`/grill-me`** → Challenge the fix design. Stress-test the proposed solution.
|
|
81
|
-
3. **`/to-prd`** → Document the fix as a formal PRD with root cause analysis.
|
|
82
|
-
4. **`/to-issues`** → Create tracking issues for the fix and any follow-up work.
|
|
83
|
-
5. **`/tdd`** → Write regression tests first, then implement the fix.
|
|
84
|
-
|
|
85
|
-
#### 🔧 Hotfix Pipeline (2 steps — for small, isolated changes ≤3 files)
|
|
86
|
-
```
|
|
87
|
-
/verify-scope → /fix-and-test
|
|
88
|
-
```
|
|
89
|
-
1. **`/verify-scope`** → Confirm change is small (≤3 files, no new API, no dependency changes). Provide scope justification in summary.
|
|
90
|
-
2. **`/fix-and-test`** → Apply fix + write regression test if applicable.
|
|
91
|
-
|
|
92
|
-
**When to use hotfix:** typos, config values, minor CSS, off-by-one errors, missing imports, small bug fixes with obvious root cause. If the change grows beyond scope, reset and escalate to `bugfix` or `feature` pipeline.
|
|
93
|
-
|
|
94
|
-
**ENFORCEMENT PROTOCOL:**
|
|
95
|
-
- After each step completion → call `pipeline_checkpoint(task, runId, step, "completed", summary)`
|
|
96
|
-
- Before each step start → call `pipeline_status(task, runId)`
|
|
97
|
-
- To cancel a run → call `pipeline_reset(task, runId, confirm=true)`; history is preserved
|
|
98
|
-
- The MCP tool enforces ordering at runtime — out-of-order calls are **rejected with error**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## MCP Tool Selection
|
|
104
|
-
|
|
105
|
-
| Situation | Use Tool | NOT | Why |
|
|
106
|
-
|---|---|---|---|
|
|
107
|
-
| Find symbol definition, function, class | `code_search` | `grep_search` | Semantic search, understands code structure |
|
|
108
|
-
| Find all callers of a function | `find_callers` | `grep_search` | Follows call graph, not just text match |
|
|
109
|
-
| Find all functions called by a function | `find_callees` | — | Call graph traversal |
|
|
110
|
-
| Explore file structure & dependencies | `explore_code` | `list_dir` | Understands imports, exports, relationships |
|
|
111
|
-
| Search in config/docs (YAML, JSON, .env, markdown) | `grep_search` | `code_search` | Non-code files, literal string match |
|
|
112
|
-
| "What breaks if I change this?" | `impact_analysis` | — | Blast radius — always update index first |
|
|
113
|
-
| Save a decision/bug-fix/convention | `remember` | — | Cross-session persistence |
|
|
114
|
-
| Recall what was decided about X | `recall` | — | Search by keyword |
|
|
115
|
-
| Load full knowledge graph | `read_knowledge` | — | Session start, get full context |
|
|
116
|
-
|
|
117
|
-
**Rule: DEFAULT to `code_search` for code. Fall back to `grep_search` ONLY for non-code files or literal strings.**
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Auto-Trigger Skills (MANDATORY)
|
|
122
|
-
|
|
123
|
-
### Workflow Skills
|
|
124
|
-
|
|
125
|
-
| Skill | Trigger Conditions | Agent Action |
|
|
126
|
-
|---|---|---|
|
|
127
|
-
| `spec-clarification` | Design decision, architecture choice, plan review | Load SKILL.md → Start alignment session |
|
|
128
|
-
| `bug-diagnostics` | Bug report, error log, "fails", "crashes" | Load SKILL.md → Reproduce → minimise → hypothesise → fix |
|
|
129
|
-
| `task-breakdown` | Plan/PRD completed, "break down", "create tickets" | Load SKILL.md → Convert plan to vertical-slice issues |
|
|
130
|
-
| `prd-gen` | New feature/product description with enough context | Load SKILL.md → Extract PRD from conversation context |
|
|
131
|
-
| `prototype` | "mockup", "explore options", unclear UI/logic | Load SKILL.md → Build throwaway prototype |
|
|
132
|
-
| `tdd-loop` | Feature implementation, bug fix, "write tests" | Load SKILL.md → Apply RED-GREEN-REFACTOR loop |
|
|
133
|
-
|
|
134
|
-
### UI/UX Design Skills
|
|
135
|
-
|
|
136
|
-
| Skill | Trigger Conditions | Agent Action |
|
|
137
|
-
|---|---|---|
|
|
138
|
-
| `ui-style-rules` | Any web UI task: page layout, component styling | Load SKILL.md → Apply anti-slop design rules |
|
|
139
|
-
| `web-mockup-gen` | Web UI concept needed before coding | Load SKILL.md → Generate web design reference images |
|
|
140
|
-
| `mobile-mockup-gen` | Mobile UI concept needed before coding | Load SKILL.md → Generate mobile screen mockups |
|
|
141
|
-
| `mobile-rules` | Any mobile UI implementation: Flutter, touch interaction | Load SKILL.md → Apply platform conventions |
|
|
142
|
-
| `stitch-design-flow` | "stitch", "tạo trên stitch", "/stitch-flow", design UI (khi stitch preset active) | Load SKILL.md → Collaborative 8-step Stitch design flow |
|
|
143
|
-
| `figma-handoff` | Figma URL detected (`figma.com/...`), "figma", "/figma", "code theo Figma" (khi figma preset active) | Load SKILL.md → Extract design → generate code |
|
|
144
|
-
| `design-to-code` | "code theo design", "pull code", "/design-to-code", design-to-code conversion | Load SKILL.md → Auto-detect input → route to correct design tool |
|
|
145
|
-
| `flutter-fix-layout-issues` | "overflow", "unbounded height", `RenderFlex`, layout error | Load SKILL.md → Fix overflow/constraint issues |
|
|
146
|
-
| `flutter-build-responsive-layout` | "responsive", "tablet", "media query", adaptive layout | Load SKILL.md → Build adaptive layout |
|
|
147
|
-
| `flutter-setup-declarative-routing` | "routing", "deep link", "go_router", URL navigation | Load SKILL.md → Configure declarative routing |
|
|
148
|
-
| `flutter-add-widget-test` | "widget test", "test component", "verify UI rendering" | Load SKILL.md → Write widget test |
|
|
149
|
-
| `flutter-add-integration-test` | "integration test", "e2e", "Flutter Driver" | Load SKILL.md → Add integration test |
|
|
150
|
-
| `flutter-implement-json-serialization` | "fromJson", "toJson", "model class", API mapping | Load SKILL.md → Create JSON serialization |
|
|
151
|
-
| `flutter-setup-localization` | "localization", "i18n", "intl", ".arb" | Load SKILL.md → Setup l10n |
|
|
152
|
-
| `flutter-apply-architecture-best-practices` | "architecture", "layer", project structure | Load SKILL.md → Apply layered architecture |
|
|
153
|
-
| `flutter-add-widget-preview` | "preview", "widget catalog", "golden test" | Load SKILL.md → Add widget preview |
|
|
154
|
-
| `flutter-use-http-package` | "http request", "REST API", "fetch data" | Load SKILL.md → Use http package |
|
|
155
|
-
|
|
156
|
-
### BA/QC Skills — auto-trigger for requirements and testing:
|
|
157
|
-
|
|
158
|
-
| Skill | Trigger Conditions | Agent Action |
|
|
159
|
-
|---|---|---|
|
|
160
|
-
| `ba-urd-decomposer` | "URD", "phân rã URD", "feature list", .pdf (BA context) | Load SKILL.md → Parse URD → feature list |
|
|
161
|
-
| `ba-clarification-session` | "làm rõ yêu cầu", "clarify", "hỏi PO" | Load SKILL.md → Generate Q&A questions |
|
|
162
|
-
| `ba-specs-writer` | "viết specs", "đặc tả", "tạo specs", "PTTK" | Load SKILL.md → Generate Specs document |
|
|
163
|
-
| `ba-feature-tracker` | "tiến độ BA", "feature tracker", "BA progress" | Load SKILL.md → Show BA dashboard |
|
|
164
|
-
| `ba-requirements-generator` | "BRD", "user story", "sinh BRD", "tạo BRD" | Load SKILL.md → Generate BRD/User Story |
|
|
165
|
-
| `pdf-specs-parser` | "parse PDF specs", "đọc PTTK", .pdf (specs context) | Load SKILL.md → Extract API/UI definitions |
|
|
166
|
-
| `qc-template-parser` | "mẫu QC", "import QC template", .xlsx (QC context) | Load SKILL.md → Learn Excel template |
|
|
167
|
-
| `qc-bidv-workflow` | "tạo testcase BIDV", "QC workflow" | Load SKILL.md → Run BIDV QC pipeline |
|
|
168
|
-
| `testcase-generator` | "sinh test case", "generate TCs", "tạo testcase" | Load SKILL.md → Generate Excel testcase |
|
|
169
|
-
| `mindmap-reader` | "mindmap", "xmind", .xmind/.mm file | Load SKILL.md → Parse mindmap → JSON |
|
|
170
|
-
| `specs-to-mindmap` | "specs sang mindmap", "tạo outline từ specs" | Load SKILL.md → Specs → outline |
|
|
171
|
-
| `requirement-coverage` | "bao phủ yêu cầu", "traceability", "coverage" | Load SKILL.md → Requirements vs test cases |
|
|
172
|
-
| `webapp-testing` | "E2E test", "Playwright", "test trình duyệt" | Load SKILL.md → E2E/Playwright audit |
|
|
173
|
-
|
|
174
|
-
### ⚠️ DOMAIN SKILL LOADING (CRITICAL — DO NOT SKIP)
|
|
175
|
-
|
|
176
|
-
Before writing ANY UI, design, or visual code:
|
|
177
|
-
1. **Web UI** → READ `.agents/skills/ui-style-rules/SKILL.md` — MANDATORY
|
|
178
|
-
2. **Mobile UI** → READ `.agents/skills/mobile-rules/SKILL.md` — MANDATORY
|
|
179
|
-
3. **Image/asset gen (web)** → READ `.agents/skills/web-mockup-gen/SKILL.md`
|
|
180
|
-
4. **Image/asset gen (mobile)** → READ `.agents/skills/mobile-mockup-gen/SKILL.md`
|
|
181
|
-
5. **Architecture decision** → READ `.agents/skills/stress-test-plan/SKILL.md`
|
|
182
|
-
|
|
183
|
-
**Violation = SLOP output. Writing UI code without design skill = P0 violation.**
|
|
184
|
-
|
|
185
|
-
## Socratic Gate
|
|
186
|
-
|
|
187
|
-
Every user request must pass through the Socratic Gate before ANY implementation:
|
|
188
|
-
|
|
189
|
-
| Request Type | Strategy | Required Action |
|
|
190
|
-
|---|---|---|
|
|
191
|
-
| **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
|
|
192
|
-
| **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
|
|
193
|
-
| **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
|
|
194
|
-
|
|
195
|
-
> [!IMPORTANT]
|
|
196
|
-
> **STRICT SOCRATIC & WORKFLOW ENFORCEMENT:**
|
|
197
|
-
> - **DO NOT write any code logic, execute modifications, or create plans before completing the required Socratic Gate action.** Bypassing the Socratic Gate is a P0 protocol violation.
|
|
198
|
-
> - **DO NOT bypass specialized workflow skills** (like `bug-diagnostics` for debugging, `spec-clarification` for specifications, `tdd-loop` for writing code/tests) even if the task or error log seems simple or clear. Bypassing skills is a P0 protocol violation.
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
## Universal Rules
|
|
203
|
-
|
|
204
|
-
### Clean Code (Global Mandatory)
|
|
205
|
-
- **Code**: Concise, direct, no over-engineering. Self-documenting.
|
|
206
|
-
- **Laziness Ladder**: Before writing code, stop at the first rung that holds: YAGNI → Reuse existing → Stdlib → Native platform → Installed dep → One-liner → Minimum viable. The ladder runs AFTER understanding the problem.
|
|
207
|
-
- **Bug Fix**: Root cause, not symptom. Grep every caller, fix the shared function once.
|
|
208
|
-
- **No Bloat**: No unrequested abstractions, no scaffolding "for later", deletion > addition, fewest files.
|
|
209
|
-
- **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
|
|
210
|
-
- **Performance**: Measure first. Adhere to current Core Web Vitals standards.
|
|
211
|
-
|
|
212
|
-
### Quick Reference
|
|
213
|
-
- **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `debugger`
|
|
214
|
-
- **Key Skills**: `clean-code`, `brainstorming`, `ui-style-rules`, `mobile-rules`, `web-mockup-gen`, `mobile-mockup-gen`, `stitch-design-flow`, `bug-diagnostics`, `tdd-loop`, `spec-clarification`, `prd-gen`, `task-breakdown`, `prototype`, `stress-test-plan`, `skill-generator`, `git-safety-guardrails`, `git-hook-setup`, `test-type-migration`, `exercise-scaffold`, `interactive-teaching`, `writing-flow`, `raw-idea-collector`, `draft-shaper`, `project-config-wizard`, `skill-writing-guide`, `architecture-rules`, `solution-decision-map`, `task-implementation`, `git-conflict-resolver`, `workflow-navigator`, `terse-communication`, `session-handoff`
|
|
13
|
+
Tool interfaces: `docs/agents/mcp-tools.md`. Project/domain and issue conventions: `docs/agents/domain.md` and `docs/agents/issue-tracker.md`. Support: info.alphatechs.ai@gmail.com.
|
|
@@ -1,232 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
3
|
-
globs: **/*
|
|
2
|
+
description: APT session bootstrap and workspace contract
|
|
4
3
|
alwaysApply: true
|
|
5
4
|
---
|
|
6
5
|
|
|
7
|
-
#
|
|
6
|
+
# APT workspace contract
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
At session start and after context recovery, call `session_bootstrap` for this workspace and read `docs/agents/apt-runtime.md` once per context. Read project conventions in `.agents/memory/MEMORY.md`; retrieve only relevant dynamic memory. Report unavailable backends once and use available fallbacks.
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
For new or changed intent, call `route_request` with the target, stack and explicit skills. Use `skill_load` for selected skills and current-step references. Do not load the full trigger catalog or repeat rules on every tool call.
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
Before code changes, bind `pipeline_status` and `pipeline_start` or `pipeline_use` to an explicit task, runId and workspace. Reserve with `pipeline_next`; verify and checkpoint current code before completion. Read-only questions, review and existing tests need no code-change pipeline. Clarify only unresolved decisions.
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
Use at most four actors including the coordinator and one writer per workspace. Respect host permissions, Plan Mode and user stops. Never claim independent review or native enforcement without observed capability. Keep attempts and evidence across resume; do not reset exhausted budgets.
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
Preserve custom files. Write concise code and prose, run suitable checks, and review staged, unstaged and relevant new files. Publishing, merging and external messages require authorization. Strong caveman style is opt-in.
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Triage labels
|
|
22
|
-
|
|
23
|
-
Default label vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See `docs/agents/triage-labels.md`.
|
|
24
|
-
|
|
25
|
-
### Domain docs
|
|
26
|
-
|
|
27
|
-
Single-context layout — one `CONTEXT.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`.
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## ⛔ CRITICAL: apt-mcp-agent TOOL USAGE (P0 — READ FIRST)
|
|
32
|
-
|
|
33
|
-
**You have `apt-mcp-agent` MCP tools available. You MUST use them:**
|
|
34
|
-
- **Before ANY code search**: use `explore_code` or `code_search` — NOT grep_search for code symbols
|
|
35
|
-
- **Before executable changes**: call `pipeline_status`, then `pipeline_start` or `pipeline_use`
|
|
36
|
-
- **After each pipeline step**: call `pipeline_checkpoint` with required `task` and `runId`
|
|
37
|
-
- **Session start**: call `read_knowledge` + `pipeline_status`
|
|
38
|
-
|
|
39
|
-
Ignoring these tools and using only built-in IDE tools is a **P0 protocol violation**.
|
|
40
|
-
|
|
41
|
-
## 🗺️ Session Start Protocol (MANDATORY)
|
|
42
|
-
|
|
43
|
-
At the start of every session:
|
|
44
|
-
1. Read `.agents/ARCHITECTURE.md` to understand Agents, Skills, and Scripts.
|
|
45
|
-
2. Read `.agents/memory/MEMORY.md` to load persistent project conventions, user preferences, and tech decisions.
|
|
46
|
-
3. Read `docs/agents/mcp-tools.md` to load MCP tool selection rules & memory conventions.
|
|
47
|
-
4. Call `read_knowledge` to load dynamic knowledge graph from memory.
|
|
48
|
-
5. **Read `.agents/skill-triggers.json` to load auto-routing rules for all skills/workflows/tools.**
|
|
49
|
-
|
|
50
|
-
### ⚠️ MCP TOOL ACCESSIBILITY & FALLBACK WARNING (CRITICAL)
|
|
51
|
-
If the specialized MCP tool `code_search` or other core MCP tools (e.g., `recall`, `remember`, `impact_analysis`) are not in your available tools list:
|
|
52
|
-
- **DO NOT silently fall back to basic text search or skip debugging workflows.**
|
|
53
|
-
- **STOP immediately, warn the user** that the `apt-mcp-agent` server did not start successfully or has been disabled in the IDE settings, and recommend they run `npx apt-mcp-agent-setup status` to check their setup.
|
|
54
|
-
- Only proceed with fallback tools (e.g. `grep_search`) if the user explicitly approves it.
|
|
55
|
-
|
|
56
|
-
### 🛠️ ENFORCED DEVELOPER PIPELINES (MANDATORY — MCP TOOL GATE)
|
|
57
|
-
|
|
58
|
-
Before writing any code or implementing features, you MUST follow one of the three enforced pipelines below.
|
|
59
|
-
**Start or bind a run with `pipeline_start(pipeline, task, workspace)` or `pipeline_use(task, runId)`.**
|
|
60
|
-
**After each step call `pipeline_checkpoint(task, runId, step, status="completed", summary)`.**
|
|
61
|
-
|
|
62
|
-
Content-only documentation changes that do not affect executable behavior are exempt from PRD, issue, and TDD pipeline steps. Agent contracts such as `AGENTS.md`, `SKILL.md`, trigger maps, pipeline definitions, and runtime configuration are operational and are not exempt.
|
|
63
|
-
Skipping steps or executing out-of-order is a **P0 protocol violation** — the tool will REJECT invalid transitions.
|
|
64
|
-
|
|
65
|
-
#### 🚀 Feature Development Pipeline (5 steps — NO EXCEPTIONS, NO SKIP)
|
|
66
|
-
```
|
|
67
|
-
/grill-me → /to-prd → /to-issues → /tdd → /improve-codebase-architecture
|
|
68
|
-
```
|
|
69
|
-
1. **`/grill-me`** → Stress-test the plan/design with relentless Socratic questions. Challenge edge cases, security, performance.
|
|
70
|
-
2. **`/to-prd`** → Synthesize the grill-me session and conversation context into a formal PRD document (routes to `prd-gen`).
|
|
71
|
-
3. **`/to-issues`** → Break PRD into vertical-slice issues on the issue tracker. Create `{task-slug}.md` for tracking.
|
|
72
|
-
4. **`/tdd`** → Implement code test-first using RED-GREEN-REFACTOR cycle.
|
|
73
|
-
5. **`/improve-codebase-architecture`** → Review and deepen architecture. Generate HTML report + grill-me session on codebase quality.
|
|
74
|
-
|
|
75
|
-
#### 🐛 Bug Fix Pipeline (5 steps — NO EXCEPTIONS, NO SKIP)
|
|
76
|
-
```
|
|
77
|
-
/diagnose → /grill-me → /to-prd → /to-issues → /tdd
|
|
78
|
-
```
|
|
79
|
-
1. **`/diagnose`** → Build feedback loop: reproduce → minimize → hypothesize → fix.
|
|
80
|
-
2. **`/grill-me`** → Challenge the fix design. Stress-test the proposed solution.
|
|
81
|
-
3. **`/to-prd`** → Document the fix as a formal PRD with root cause analysis.
|
|
82
|
-
4. **`/to-issues`** → Create tracking issues for the fix and any follow-up work.
|
|
83
|
-
5. **`/tdd`** → Write regression tests first, then implement the fix.
|
|
84
|
-
|
|
85
|
-
#### 🔧 Hotfix Pipeline (2 steps — for small, isolated changes ≤3 files)
|
|
86
|
-
```
|
|
87
|
-
/verify-scope → /fix-and-test
|
|
88
|
-
```
|
|
89
|
-
1. **`/verify-scope`** → Confirm change is small (≤3 files, no new API, no dependency changes). Provide scope justification in summary.
|
|
90
|
-
2. **`/fix-and-test`** → Apply fix + write regression test if applicable.
|
|
91
|
-
|
|
92
|
-
**When to use hotfix:** typos, config values, minor CSS, off-by-one errors, missing imports, small bug fixes with obvious root cause. If the change grows beyond scope, reset and escalate to `bugfix` or `feature` pipeline.
|
|
93
|
-
|
|
94
|
-
**ENFORCEMENT PROTOCOL:**
|
|
95
|
-
- After each step completion → call `pipeline_checkpoint(task, runId, step, "completed", summary)`
|
|
96
|
-
- Before each step start → call `pipeline_status(task, runId)`
|
|
97
|
-
- To cancel a run → call `pipeline_reset(task, runId, confirm=true)`; history is preserved
|
|
98
|
-
- The MCP tool enforces ordering at runtime — out-of-order calls are **rejected with error**
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## 🔍 MCP Tool Selection
|
|
103
|
-
|
|
104
|
-
| Situation | Use Tool | NOT | Why |
|
|
105
|
-
|---|---|---|---|
|
|
106
|
-
| Find symbol definition, function, class | `code_search` | `grep_search` | Semantic search, understands code structure |
|
|
107
|
-
| Find all callers of a function | `find_callers` | `grep_search` | Follows call graph, not just text match |
|
|
108
|
-
| Find all functions called by a function | `find_callees` | — | Call graph traversal |
|
|
109
|
-
| Explore file structure & dependencies | `explore_code` | `list_dir` | Understands imports, exports, relationships |
|
|
110
|
-
| Search in config/docs (YAML, JSON, .env, markdown) | `grep_search` | `code_search` | Non-code files, literal string match |
|
|
111
|
-
| "What breaks if I change this?" | `impact_analysis` | — | Blast radius — always update index first |
|
|
112
|
-
| Save a decision/bug-fix/convention | `remember` | — | Cross-session persistence |
|
|
113
|
-
| Recall what was decided about X | `recall` | — | Search by keyword |
|
|
114
|
-
| Load full knowledge graph | `read_knowledge` | — | Session start, get full context |
|
|
115
|
-
|
|
116
|
-
**Rule: DEFAULT to `code_search` for code. Fall back to `grep_search` ONLY for non-code files or literal strings.**
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## 🎯 Auto-Trigger Skills (MANDATORY)
|
|
121
|
-
|
|
122
|
-
### Workflow Skills
|
|
123
|
-
|
|
124
|
-
| Skill | Trigger Conditions | Agent Action |
|
|
125
|
-
|---|---|---|
|
|
126
|
-
| `spec-clarification` | Design decision, architecture choice, plan review | Load SKILL.md → Start alignment session |
|
|
127
|
-
| `bug-diagnostics` | Bug report, error log, "fails", "crashes" | Load SKILL.md → Reproduce → minimise → hypothesise → fix |
|
|
128
|
-
| `task-breakdown` | Plan/PRD completed, "break down", "create tickets" | Load SKILL.md → Convert plan to vertical-slice issues |
|
|
129
|
-
| `prd-gen` | New feature/product description with enough context | Load SKILL.md → Extract PRD from conversation context |
|
|
130
|
-
| `prototype` | "mockup", "explore options", unclear UI/logic | Load SKILL.md → Build throwaway prototype |
|
|
131
|
-
| `tdd-loop` | Feature implementation, bug fix, "write tests" | Load SKILL.md → Apply RED-GREEN-REFACTOR loop |
|
|
132
|
-
|
|
133
|
-
### UI/UX Design Skills
|
|
134
|
-
|
|
135
|
-
| Skill | Trigger Conditions | Agent Action |
|
|
136
|
-
|---|---|---|
|
|
137
|
-
| `ui-style-rules` | Any web UI task: page layout, component styling | Load SKILL.md → Apply anti-slop design rules |
|
|
138
|
-
| `web-mockup-gen` | Web UI concept needed before coding | Load SKILL.md → Generate web design reference images |
|
|
139
|
-
| `mobile-mockup-gen` | Mobile UI concept needed before coding | Load SKILL.md → Generate mobile screen mockups |
|
|
140
|
-
| `mobile-rules` | Any mobile UI implementation: Flutter, touch interaction | Load SKILL.md → Apply platform conventions |
|
|
141
|
-
| `stitch-design-flow` | "stitch", "tạo trên stitch", "/stitch-flow", design UI (khi stitch preset active) | Load SKILL.md → Collaborative 8-step Stitch design flow |
|
|
142
|
-
| `figma-handoff` | Figma URL detected (`figma.com/...`), "figma", "/figma", "code theo Figma" (khi figma preset active) | Load SKILL.md → Extract design → generate code |
|
|
143
|
-
| `design-to-code` | "code theo design", "pull code", "/design-to-code", design-to-code conversion | Load SKILL.md → Auto-detect input → route to correct design tool |
|
|
144
|
-
| `flutter-fix-layout-issues` | "overflow", "unbounded height", `RenderFlex`, layout error | Load SKILL.md → Fix overflow/constraint issues |
|
|
145
|
-
| `flutter-build-responsive-layout` | "responsive", "tablet", "media query", adaptive layout | Load SKILL.md → Build adaptive layout |
|
|
146
|
-
| `flutter-setup-declarative-routing` | "routing", "deep link", "go_router", URL navigation | Load SKILL.md → Configure declarative routing |
|
|
147
|
-
| `flutter-add-widget-test` | "widget test", "test component", "verify UI rendering" | Load SKILL.md → Write widget test |
|
|
148
|
-
| `flutter-add-integration-test` | "integration test", "e2e", "Flutter Driver" | Load SKILL.md → Add integration test |
|
|
149
|
-
| `flutter-implement-json-serialization` | "fromJson", "toJson", "model class", API mapping | Load SKILL.md → Create JSON serialization |
|
|
150
|
-
| `flutter-setup-localization` | "localization", "i18n", "intl", ".arb" | Load SKILL.md → Setup l10n |
|
|
151
|
-
| `flutter-apply-architecture-best-practices` | "architecture", "layer", project structure | Load SKILL.md → Apply layered architecture |
|
|
152
|
-
| `flutter-add-widget-preview` | "preview", "widget catalog", "golden test" | Load SKILL.md → Add widget preview |
|
|
153
|
-
| `flutter-use-http-package` | "http request", "REST API", "fetch data" | Load SKILL.md → Use http package |
|
|
154
|
-
|
|
155
|
-
### BA/QC Skills — auto-trigger for requirements and testing:
|
|
156
|
-
|
|
157
|
-
| Skill | Trigger Conditions | Agent Action |
|
|
158
|
-
|---|---|---|
|
|
159
|
-
| `ba-urd-decomposer` | "URD", "phân rã URD", "feature list", .pdf (BA context) | Load SKILL.md → Parse URD → feature list |
|
|
160
|
-
| `ba-clarification-session` | "làm rõ yêu cầu", "clarify", "hỏi PO" | Load SKILL.md → Generate Q&A questions |
|
|
161
|
-
| `ba-specs-writer` | "viết specs", "đặc tả", "tạo specs", "PTTK" | Load SKILL.md → Generate Specs document |
|
|
162
|
-
| `ba-feature-tracker` | "tiến độ BA", "feature tracker", "BA progress" | Load SKILL.md → Show BA dashboard |
|
|
163
|
-
| `ba-requirements-generator` | "BRD", "user story", "sinh BRD", "tạo BRD" | Load SKILL.md → Generate BRD/User Story |
|
|
164
|
-
| `pdf-specs-parser` | "parse PDF specs", "đọc PTTK", .pdf (specs context) | Load SKILL.md → Extract API/UI definitions |
|
|
165
|
-
| `qc-template-parser` | "mẫu QC", "import QC template", .xlsx (QC context) | Load SKILL.md → Learn Excel template |
|
|
166
|
-
| `qc-bidv-workflow` | "tạo testcase BIDV", "QC workflow" | Load SKILL.md → Run BIDV QC pipeline |
|
|
167
|
-
| `testcase-generator` | "sinh test case", "generate TCs", "tạo testcase" | Load SKILL.md → Generate Excel testcase |
|
|
168
|
-
| `mindmap-reader` | "mindmap", "xmind", .xmind/.mm file | Load SKILL.md → Parse mindmap → JSON |
|
|
169
|
-
| `specs-to-mindmap` | "specs sang mindmap", "tạo outline từ specs" | Load SKILL.md → Specs → outline |
|
|
170
|
-
| `requirement-coverage` | "bao phủ yêu cầu", "traceability", "coverage" | Load SKILL.md → Requirements vs test cases |
|
|
171
|
-
| `webapp-testing` | "E2E test", "Playwright", "test trình duyệt" | Load SKILL.md → E2E/Playwright audit |
|
|
172
|
-
|
|
173
|
-
### Failure Conditions
|
|
174
|
-
- ❌ Writing UI code without loading design skill = **SLOP RISK**
|
|
175
|
-
- ❌ Creating mobile screen without `mobile-rules` = **PLATFORM VIOLATION**
|
|
176
|
-
|
|
177
|
-
### ⚠️ DOMAIN SKILL LOADING (CRITICAL — DO NOT SKIP)
|
|
178
|
-
|
|
179
|
-
Before writing ANY UI, design, or visual code:
|
|
180
|
-
1. **Web UI** → READ `.agents/skills/ui-style-rules/SKILL.md` — MANDATORY
|
|
181
|
-
2. **Mobile UI** → READ `.agents/skills/mobile-rules/SKILL.md` — MANDATORY
|
|
182
|
-
3. **Image/asset gen (web)** → READ `.agents/skills/web-mockup-gen/SKILL.md`
|
|
183
|
-
4. **Image/asset gen (mobile)** → READ `.agents/skills/mobile-mockup-gen/SKILL.md`
|
|
184
|
-
5. **Architecture decision** → READ `.agents/skills/stress-test-plan/SKILL.md`
|
|
185
|
-
|
|
186
|
-
**Violation = SLOP output. Writing UI code without design skill = P0 violation.**
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## 🛑 Socratic Gate
|
|
191
|
-
|
|
192
|
-
Every user request must pass through the Socratic Gate before ANY implementation:
|
|
193
|
-
|
|
194
|
-
| Request Type | Strategy | Required Action |
|
|
195
|
-
|---|---|---|
|
|
196
|
-
| **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
|
|
197
|
-
| **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
|
|
198
|
-
| **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
|
|
199
|
-
|
|
200
|
-
> [!IMPORTANT]
|
|
201
|
-
> **STRICT SOCRATIC & WORKFLOW ENFORCEMENT:**
|
|
202
|
-
> - **DO NOT write any code logic, execute modifications, or create plans before completing the required Socratic Gate action.** Bypassing the Socratic Gate is a P0 protocol violation.
|
|
203
|
-
> - **DO NOT bypass specialized workflow skills** (like `bug-diagnostics` for debugging, `spec-clarification` for specifications, `tdd-loop` for writing code/tests) even if the task or error log seems simple or clear. Bypassing skills is a P0 protocol violation.
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
## Universal Rules
|
|
208
|
-
|
|
209
|
-
### Clean Code (Global Mandatory)
|
|
210
|
-
- **Code**: Concise, direct, no over-engineering. Self-documenting.
|
|
211
|
-
- **Laziness Ladder**: Before writing code, stop at the first rung that holds: YAGNI → Reuse existing → Stdlib → Native platform → Installed dep → One-liner → Minimum viable. The ladder runs AFTER understanding the problem.
|
|
212
|
-
- **Bug Fix**: Root cause, not symptom. Grep every caller, fix the shared function once.
|
|
213
|
-
- **No Bloat**: No unrequested abstractions, no scaffolding "for later", deletion > addition, fewest files.
|
|
214
|
-
- **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
|
|
215
|
-
- **Performance**: Measure first. Adhere to current Core Web Vitals standards.
|
|
216
|
-
|
|
217
|
-
### Anti-Slop Writing (Global Mandatory)
|
|
218
|
-
|
|
219
|
-
When generating **any prose content** (.md, .docx, PRDs, specs, articles, BA docs, commit messages, PR descriptions), automatically avoid AI-writing patterns:
|
|
220
|
-
- **Ban list**: delve, tapestry, landscape (abstract), vibrant, crucial, foster, underscore, showcase, pivotal, testament, interplay, intricacies, garner, enhance, enduring
|
|
221
|
-
- **No copula avoidance**: use "is/are/has" not "serves as/stands as/boasts/features"
|
|
222
|
-
- **No em dashes**: replace with periods, commas, colons, or parentheses
|
|
223
|
-
- **No signposting**: no "Let's dive in", "Here's what you need to know"
|
|
224
|
-
- **No filler**: "In order to" → "To", "Due to the fact that" → "Because"
|
|
225
|
-
- **No sycophancy**: no "Great question!", "Absolutely!", "I hope this helps!"
|
|
226
|
-
- **Prefer**: plain verbs, specific details, varied sentence length, active voice
|
|
227
|
-
|
|
228
|
-
Full 33-pattern reference: `.agents/skills/humanizer/references/patterns.md`
|
|
229
|
-
|
|
230
|
-
### Quick Reference
|
|
231
|
-
- **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `debugger`
|
|
232
|
-
- **Key Skills**: `clean-code`, `brainstorming`, `ui-style-rules`, `mobile-rules`, `web-mockup-gen`, `mobile-mockup-gen`, `stitch-design-flow`, `bug-diagnostics`, `tdd-loop`, `spec-clarification`, `prd-gen`, `task-breakdown`, `prototype`, `stress-test-plan`, `skill-generator`, `git-safety-guardrails`, `git-hook-setup`, `test-type-migration`, `exercise-scaffold`, `interactive-teaching`, `writing-flow`, `raw-idea-collector`, `draft-shaper`, `humanizer`, `project-config-wizard`, `skill-writing-guide`, `architecture-rules`, `solution-decision-map`, `task-implementation`, `git-conflict-resolver`, `workflow-navigator`, `terse-communication`, `session-handoff`
|
|
18
|
+
Tool interfaces: `docs/agents/mcp-tools.md`. Project/domain and issue conventions: `docs/agents/domain.md` and `docs/agents/issue-tracker.md`. Support: info.alphatechs.ai@gmail.com.
|