apt-mcp-agent-setup 2.0.1 → 3.0.0

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 (48) hide show
  1. package/bin/cli.js +1 -1
  2. package/bundle/NOTICES.md +0 -0
  3. package/bundle/core.enc +0 -0
  4. package/bundle/mcp-rules.enc +0 -0
  5. package/bundle/skills-aso.enc +0 -0
  6. package/bundle/skills-ba.enc +0 -0
  7. package/bundle/skills-base.enc +0 -0
  8. package/bundle/skills-be.enc +0 -0
  9. package/bundle/skills-design.enc +0 -0
  10. package/bundle/skills-fe.enc +0 -0
  11. package/bundle/skills-mobile.enc +0 -0
  12. package/bundle/skills-pm.enc +0 -0
  13. package/integrity-manifest.json +28 -17
  14. package/package.json +1 -1
  15. package/src/core/catalog.js +1 -0
  16. package/src/core/doctor.js +1 -0
  17. package/src/core/execution.js +1 -0
  18. package/src/core/hook-bridge.js +1 -0
  19. package/src/core/host-adapters.js +1 -0
  20. package/src/core/memory-store.js +1 -0
  21. package/src/core/session.js +1 -0
  22. package/src/core/skill-names.js +1 -0
  23. package/src/installer/global-setup.js +1 -1
  24. package/src/installer/host-hooks.js +1 -0
  25. package/src/installer/managed-config.js +1 -0
  26. package/src/installer/platform-config.js +1 -1
  27. package/src/installer/prerequisites.js +1 -1
  28. package/src/installer/project-setup.js +1 -1
  29. package/src/installer/setup-wizard.js +1 -1
  30. package/src/license/crypto.js +1 -1
  31. package/src/license/fingerprint.js +1 -1
  32. package/src/license/terms.js +1 -1
  33. package/src/license/verify.js +1 -1
  34. package/src/presets/index.js +1 -1
  35. package/src/proxy/backends.js +1 -1
  36. package/src/proxy/core-tools.js +1 -0
  37. package/src/proxy/pipeline.js +1 -1
  38. package/src/proxy/router.config.js +1 -1
  39. package/src/proxy/router.js +1 -1
  40. package/src/proxy/server.js +1 -1
  41. package/src/templates/AGENTS.md +15 -64
  42. package/src/templates/CLAUDE.md +180 -254
  43. package/src/templates/GEMINI.md +17 -115
  44. package/src/templates/apt-runtime.md +16 -0
  45. package/src/templates/copilot-instructions.md +141 -214
  46. package/src/templates/cursorrules.mdc +166 -232
  47. package/src/templates/mcp-tools.md +176 -175
  48. package/src/templates/windsurfrules.md +141 -214
@@ -1,175 +1,176 @@
1
- # MCP Tools — Decision Tree & Conventions
2
-
3
- ## Developer pipeline 2.0
4
-
5
- - Start: `pipeline_start(pipeline, task, workspace)` with a canonical lowercase task ID.
6
- - Resume: `pipeline_use(task, runId)` binds the MCP session and project-scoped backends to the run workspace.
7
- - Progress: `pipeline_checkpoint(task, runId, step, status="completed", summary)` only accepts the next step.
8
- - Inspect: `pipeline_status()` lists current runs; task and runId inspect one run without rebinding.
9
- - Cancel: `pipeline_reset(task, runId, confirm=true)` preserves state and ledger history.
10
- - Finish: `pipeline_prepare_merge(task, runId)` never merges, pushes, publishes, or deletes a branch.
11
-
12
- Git projects share pipeline state through the Git common directory. Non-Git projects use `.agents/pipelines` and can run in place. Git bootstrap for a managed worktree always requires a read-only preview and direct user confirmation.
13
-
14
- Pipeline enforcement covers proxied MCP tools only. Native host shell and file tools must follow the returned `workspacePath` explicitly.
15
-
16
- ## 🔍 Tool Selection — When to Use What
17
-
18
- ### Code Search & Navigation
19
-
20
- | Situation | Use Tool | NOT | Why |
21
- |---|---|---|---|
22
- | Explore file structure & dependencies | `explore_code` | `list_dir` | **PRIMARY TOOL — call FIRST for any code question or before edit** |
23
- | Find symbol definition, function, class | `code_search` | `grep_search` | Semantic search, understands code structure |
24
- | Find all callers of a function | `find_callers` | `grep_search` | Follows call graph, not just text match |
25
- | Find all functions called by a function | `find_callees` | — | Call graph traversal |
26
- | List files matching a pattern | `list_code_files` | `list_dir` | Faster, code-aware filtering |
27
- | Search in config files (YAML, JSON, .env) | `grep_search` | `code_search` | Non-code files, literal string match |
28
- | Search in markdown, docs, comments | `grep_search` | `code_search` | Plain text, not code symbols |
29
- | Search for exact string literal in code | `grep_search` | `code_search` | Literal match (error messages, magic strings) |
30
-
31
- **Rule: explore_code FIRST. grep_search ONLY non-code. No grep loops.**
32
-
33
- ### Impact Analysis
34
-
35
- | Situation | Use Tool | Why |
36
- |---|---|---|
37
- | "What breaks if I change this function?" | `impact_analysis` | Blast radius — shows all affected files/functions |
38
- | Before refactoring a shared module | `impact_analysis` | Prevent unintended side effects |
39
- | Code review — assessing risk of a PR | `impact_analysis` | Quantify change scope |
40
- | Simple "where is this used?" | `find_callers` | Lighter weight than full impact analysis |
41
-
42
- ### Persistent Knowledge
43
-
44
- | Situation | Use Tool | Why |
45
- |---|---|---|
46
- | Save a decision made this session | `remember` | Cross-session persistence |
47
- | Save a bug fix (root cause + solution) | `remember` | Future reference when similar bug appears |
48
- | Recall what was decided about X | `recall` | Search by keyword |
49
- | Load full knowledge graph | `read_knowledge` | Session start, get full context |
50
- | Connect two related concepts | `link_knowledge` | Build relationship graph |
51
- | Remove outdated information | `forget` | Keep knowledge graph clean |
52
-
53
- ---
54
-
55
- ## 🧠 Memory Auto-Save Protocol (MANDATORY)
56
-
57
- Agent MUST auto-call `remember` in these situations — do NOT wait for user to ask:
58
-
59
- | Trigger | What to Save |
60
- |---|---|
61
- | After completing pipeline step `grill-me` | Design decisions + constraints discussed |
62
- | After completing pipeline step `diagnose` | Root cause + reproduction steps |
63
- | After completing pipeline step `tdd` | Implementation decisions + test patterns |
64
- | After completing pipeline step `improve-architecture` | Architecture improvements + quality findings |
65
- | User states a preference or convention | What they prefer + context |
66
- | Non-trivial bug resolved | Root cause, solution, affected files |
67
-
68
- **Pipeline checkpoint responses include `memory_action` field — follow it immediately.**
69
-
70
- ### Google Drive & Online Documents
71
-
72
- | Situation | Use Tool | Why |
73
- |---|---|---|
74
- | Search files on project Drive | `gdrive-search` | Find specs, testcases, sheets |
75
- | List files inside folder | `gdrive-list-folder` | Browse project folder structure |
76
- | Upload specs/testcase (xlsx/docx) | `gdrive-upload-file` | Set `convertToGoogleFormat: true` to auto-convert to Sheets/Docs |
77
- | Update specific row/cell in Sheets | `gdrive-update-sheet-cell` | Modify cells for real-time QC collaboration |
78
- | Share sheet/doc with bank stakeholder | `gdrive-share-file` | Invite collaborators (editor/viewer) |
79
-
80
- ---
81
-
82
- ## 🔄 Index Management — When to Rebuild
83
-
84
- ### code_search index (auto-managed)
85
-
86
- | Event | Action | Notes |
87
- |---|---|---|
88
- | Files changed on disk | **Auto-update** (file watcher) | No manual action needed |
89
- | Large refactor (50+ files) | Agent runs `code_search` after changes | Index catches up automatically |
90
- | New project setup | **Auto-index** on first query | May be slow first time |
91
-
92
- **Rule: NEVER ask the user to rebuild the code search index. It auto-manages.**
93
-
94
- ### impact_analysis index (MANUAL update required)
95
-
96
- | Event | Action Required |
97
- |---|---|
98
- | Before ANY impact analysis query | Agent MUST run index update first |
99
- | After committing changes (git) | Agent MUST run index update before next query |
100
- | User manages git manually (SourceTree, etc.) | Agent auto-runs update, NEVER asks user |
101
-
102
- **Rule: ALWAYS update impact_analysis index before querying. Do it silently — never ask the user.**
103
-
104
- Before calling `impact_analysis`:
105
- 1. Run index update (silent, no user prompt)
106
- 2. Wait for completion
107
- 3. Then execute the impact query
108
-
109
- ---
110
-
111
- ## 🪜 Code Writing — Laziness Ladder
112
-
113
- Before writing ANY code, stop at the **first rung** that holds:
114
-
115
- | Rung | Check | Tool to Use | If Yes → |
116
- |---|---|---|---|
117
- | 1. YAGNI | Does this need to exist? | Think first | Skip it, explain why in one line |
118
- | 2. Reuse | Already in codebase? | `explore_code` | Reuse existing helper/util/pattern |
119
- | 3. Stdlib | Standard library does it? | Language docs | Use stdlib |
120
- | 4. Platform | Native platform feature? | — | Use it (CSS > JS, `<input type="date">` > picker lib, DB constraint > app code) |
121
- | 5. Installed dep | Already-installed dependency? | `explore_code` on package.json/pubspec | Use existing dep. No new deps for what a few lines do |
122
- | 6. One-liner | Can it be one line? | — | One line |
123
- | 7. Minimum | Only when above fail | — | Write minimum code that works |
124
-
125
- **Rule: The ladder runs AFTER understanding the problem. Read the code it touches (`explore_code`), trace the real flow, THEN climb.**
126
-
127
- **Bug fix rule: Root cause, not symptom.** Grep every caller (`find_callers`), fix the shared function once — not each caller path.
128
-
129
- ---
130
-
131
- ## 🧠 Memory Conventions — When to Save & Read
132
-
133
- ### When to SAVE (`remember`)
134
-
135
- | Trigger | Entity Type | What to Save |
136
- |---|---|---|
137
- | Resolved a non-trivial bug | `bug-fix` | Root cause, solution, affected files, how to detect similar |
138
- | Made an architecture/design decision | `decision` | What was decided, alternatives considered, rationale |
139
- | Completed a feature milestone | `feature` | What was built, key files, design choices |
140
- | Discovered a workflow/convention | `convention` | The pattern, why it exists, when to apply it |
141
- | User stated a preference | `preference` | What they prefer, context |
142
- | Completed project setup | `setup` | What was configured, tool versions, settings |
143
-
144
- **Save format:**
145
- ```
146
- Entity: [descriptive-name]
147
- Type: [bug-fix | decision | feature | convention | preference | setup]
148
- Content: [structured description]
149
- Tags: [relevant, searchable, keywords]
150
- ```
151
-
152
- ### When to READ (`recall` / `read_knowledge`)
153
-
154
- | Trigger | Action | Tool |
155
- |---|---|---|
156
- | **Session start** | Load full knowledge graph | `read_knowledge` |
157
- | Before investigating known-problematic areas | Search for related bug-fixes | `recall` with keywords |
158
- | Before making design decisions | Search for prior decisions on same topic | `recall` with topic |
159
- | Before touching a module with history | Search for conventions/gotchas | `recall` with module name |
160
- | User asks "what did we decide about X?" | Search explicitly | `recall` with X |
161
-
162
- ### Memory Architecture (2-tier)
163
-
164
- | Source | Purpose | Mutability | Location |
165
- |---|---|---|---|
166
- | `.agents/memory/MEMORY.md` | Static conventions, user preferences, coding standards | Manual edit only | Project repo |
167
- | `.memory/memory.jsonl` | Dynamic project knowledge graph | Agent read/write via MCP tools | Project root (gitignored) |
168
-
169
- **Rule: NEVER save to `.agents/memory/MEMORY.md` via MCP tools. That file is manually curated. MCP `remember`/`recall` always targets `.memory/memory.jsonl`.**
170
-
171
- ### Memory Isolation
172
-
173
- - Each project has its own `.memory/memory.jsonl` (configured via `.mcp.json`)
174
- - Global fallback: `~/.anhdh/memory/global.json` (neutral, for cross-project knowledge)
175
- - `.mcp.json` per project overrides global config → no data leakage between projects
1
+ # MCP Tools — Decision Tree & Conventions
2
+
3
+ ## Runtime and pipelines
4
+
5
+ - Bootstrap: `session_bootstrap(sessionId, contextEpoch, host, capabilities)` identifies this context and reports resumable work.
6
+ - Route: `route_request(sessionId, requestId, prompt, target, stack, explicitSkills)` returns the workflow and companion skills. Load them using `skill_load` only when needed.
7
+ - Start: `pipeline_start(pipeline, task, workspace, acceptanceCriteria, scope, sessionId)` creates a versioned run. Use `pipeline_use(task, runId)` to resume the same run.
8
+ - Execute: `pipeline_next(task, runId, sessionId, role, requestId)` reserves an attempt. Native host agents perform the work; the coordinator controls transitions.
9
+ - Verify: `pipeline_verify` records authorized argv execution under the run workspace. `pipeline_checkpoint` references evidence IDs for completion and supports report, pause, resume, release and criteria actions.
10
+ - Inspect: `pipeline_status` is read-only and does not bind sessions. `pipeline_reset` cancels without deleting history. `pipeline_prepare_merge` only prepares a report.
11
+ - Read-only questions, review and existing test execution do not require a mutation pipeline. Scope-limited changes use the short pipeline; increased risk adds required checks.
12
+ - MCP gates cover proxied calls. Native tool gates and continuation require observed host hooks. Plan Mode and user interruption take precedence.
13
+ - Codegraph failures permit file-search fallback. The proxy refreshes the review graph before impact analysis; it must report failure rather than use stale results.
14
+ - `mcp_agent_health` reports process, initialization and functional readiness separately. `npx apt-mcp-agent-setup doctor` performs read-only configuration inspection.
15
+
16
+
17
+ ## 🔍 Tool Selection — When to Use What
18
+
19
+ ### Code Search & Navigation
20
+
21
+ | Situation | Use Tool | NOT | Why |
22
+ |---|---|---|---|
23
+ | Explore file structure & dependencies | `explore_code` | `list_dir` | **PRIMARY TOOL — call FIRST for any code question or before edit** |
24
+ | Find symbol definition, function, class | `code_search` | `grep_search` | Semantic search, understands code structure |
25
+ | Find all callers of a function | `find_callers` | `grep_search` | Follows call graph, not just text match |
26
+ | Find all functions called by a function | `find_callees` | — | Call graph traversal |
27
+ | List files matching a pattern | `list_code_files` | `list_dir` | Faster, code-aware filtering |
28
+ | Search in config files (YAML, JSON, .env) | `grep_search` | `code_search` | Non-code files, literal string match |
29
+ | Search in markdown, docs, comments | `grep_search` | `code_search` | Plain text, not code symbols |
30
+ | Search for exact string literal in code | `grep_search` | `code_search` | Literal match (error messages, magic strings) |
31
+
32
+ **Rule: explore_code FIRST. grep_search ONLY non-code. No grep loops.**
33
+
34
+ ### Impact Analysis
35
+
36
+ | Situation | Use Tool | Why |
37
+ |---|---|---|
38
+ | "What breaks if I change this function?" | `impact_analysis` | Blast radius — shows all affected files/functions |
39
+ | Before refactoring a shared module | `impact_analysis` | Prevent unintended side effects |
40
+ | Code review — assessing risk of a PR | `impact_analysis` | Quantify change scope |
41
+ | Simple "where is this used?" | `find_callers` | Lighter weight than full impact analysis |
42
+
43
+ ### Persistent Knowledge
44
+
45
+ | Situation | Use Tool | Why |
46
+ |---|---|---|
47
+ | Save a decision made this session | `remember` | Cross-session persistence |
48
+ | Save a bug fix (root cause + solution) | `remember` | Future reference when similar bug appears |
49
+ | Recall what was decided about X | `recall` | Search by keyword |
50
+ | Load relevant task knowledge | `recall` | Explicit whole-graph inspection; prefer relevant recall during bootstrap |
51
+ | Connect two related concepts | `link_knowledge` | Build relationship graph |
52
+ | Remove outdated information | `forget` | Keep knowledge graph clean |
53
+
54
+ ---
55
+
56
+ ## 🧠 Memory Auto-Save Protocol (MANDATORY)
57
+
58
+ Agent MUST auto-call `remember` in these situations — do NOT wait for user to ask:
59
+
60
+ | Trigger | What to Save |
61
+ |---|---|
62
+ | After completing pipeline step `grill-me` | Design decisions + constraints discussed |
63
+ | After completing pipeline step `diagnose` | Root cause + reproduction steps |
64
+ | After completing pipeline step `tdd` | Implementation decisions + test patterns |
65
+ | After completing pipeline step `improve-architecture` | Architecture improvements + quality findings |
66
+ | User states a preference or convention | What they prefer + context |
67
+ | Non-trivial bug resolved | Root cause, solution, affected files |
68
+
69
+ **Pipeline checkpoint responses include `memory_action` field — follow it immediately.**
70
+
71
+ ### Google Drive & Online Documents
72
+
73
+ | Situation | Use Tool | Why |
74
+ |---|---|---|
75
+ | Search files on project Drive | `gdrive-search` | Find specs, testcases, sheets |
76
+ | List files inside folder | `gdrive-list-folder` | Browse project folder structure |
77
+ | Upload specs/testcase (xlsx/docx) | `gdrive-upload-file` | Set `convertToGoogleFormat: true` to auto-convert to Sheets/Docs |
78
+ | Update specific row/cell in Sheets | `gdrive-update-sheet-cell` | Modify cells for real-time QC collaboration |
79
+ | Share sheet/doc with bank stakeholder | `gdrive-share-file` | Invite collaborators (editor/viewer) |
80
+
81
+ ---
82
+
83
+ ## 🔄 Index Management — When to Rebuild
84
+
85
+ ### code_search index (auto-managed)
86
+
87
+ | Event | Action | Notes |
88
+ |---|---|---|
89
+ | Files changed on disk | **Auto-update** (file watcher) | No manual action needed |
90
+ | Large refactor (50+ files) | Agent runs `code_search` after changes | Index catches up automatically |
91
+ | New project setup | **Auto-index** on first query | May be slow first time |
92
+
93
+ **Rule: NEVER ask the user to rebuild the code search index. It auto-manages.**
94
+
95
+ ### impact_analysis index (MANUAL update required)
96
+
97
+ | Event | Action Required |
98
+ |---|---|
99
+ | Before ANY impact analysis query | Agent MUST run index update first |
100
+ | After committing changes (git) | Agent MUST run index update before next query |
101
+ | User manages git manually (SourceTree, etc.) | Agent auto-runs update, NEVER asks user |
102
+
103
+ **Rule: ALWAYS update impact_analysis index before querying. Do it silently — never ask the user.**
104
+
105
+ Before calling `impact_analysis`:
106
+ 1. Run index update (silent, no user prompt)
107
+ 2. Wait for completion
108
+ 3. Then execute the impact query
109
+
110
+ ---
111
+
112
+ ## 🪜 Code Writing — Laziness Ladder
113
+
114
+ Before writing ANY code, stop at the **first rung** that holds:
115
+
116
+ | Rung | Check | Tool to Use | If Yes → |
117
+ |---|---|---|---|
118
+ | 1. YAGNI | Does this need to exist? | Think first | Skip it, explain why in one line |
119
+ | 2. Reuse | Already in codebase? | `explore_code` | Reuse existing helper/util/pattern |
120
+ | 3. Stdlib | Standard library does it? | Language docs | Use stdlib |
121
+ | 4. Platform | Native platform feature? | — | Use it (CSS > JS, `<input type="date">` > picker lib, DB constraint > app code) |
122
+ | 5. Installed dep | Already-installed dependency? | `explore_code` on package.json/pubspec | Use existing dep. No new deps for what a few lines do |
123
+ | 6. One-liner | Can it be one line? | — | One line |
124
+ | 7. Minimum | Only when above fail | — | Write minimum code that works |
125
+
126
+ **Rule: The ladder runs AFTER understanding the problem. Read the code it touches (`explore_code`), trace the real flow, THEN climb.**
127
+
128
+ **Bug fix rule: Root cause, not symptom.** Grep every caller (`find_callers`), fix the shared function once — not each caller path.
129
+
130
+ ---
131
+
132
+ ## 🧠 Memory Conventions — When to Save & Read
133
+
134
+ ### When to SAVE (`remember`)
135
+
136
+ | Trigger | Entity Type | What to Save |
137
+ |---|---|---|
138
+ | Resolved a non-trivial bug | `bug-fix` | Root cause, solution, affected files, how to detect similar |
139
+ | Made an architecture/design decision | `decision` | What was decided, alternatives considered, rationale |
140
+ | Completed a feature milestone | `feature` | What was built, key files, design choices |
141
+ | Discovered a workflow/convention | `convention` | The pattern, why it exists, when to apply it |
142
+ | User stated a preference | `preference` | What they prefer, context |
143
+ | Completed project setup | `setup` | What was configured, tool versions, settings |
144
+
145
+ **Save format:**
146
+ ```
147
+ Entity: [descriptive-name]
148
+ Type: [bug-fix | decision | feature | convention | preference | setup]
149
+ Content: [structured description]
150
+ Tags: [relevant, searchable, keywords]
151
+ ```
152
+
153
+ ### When to READ (`recall` / `read_knowledge`)
154
+
155
+ | Trigger | Action | Tool |
156
+ |---|---|---|
157
+ | **Session start** | Load relevant task knowledge | `recall` |
158
+ | Before investigating known-problematic areas | Search for related bug-fixes | `recall` with keywords |
159
+ | Before making design decisions | Search for prior decisions on same topic | `recall` with topic |
160
+ | Before touching a module with history | Search for conventions/gotchas | `recall` with module name |
161
+ | User asks "what did we decide about X?" | Search explicitly | `recall` with X |
162
+
163
+ ### Memory Architecture (2-tier)
164
+
165
+ | Source | Purpose | Mutability | Location |
166
+ |---|---|---|---|
167
+ | `.agents/memory/MEMORY.md` | Static conventions, user preferences, coding standards | Manual edit only | Project repo |
168
+ | `.memory/memory.jsonl` | Dynamic project knowledge graph | Agent read/write via MCP tools | Project root (gitignored) |
169
+
170
+ **Rule: NEVER save to `.agents/memory/MEMORY.md` via MCP tools. That file is manually curated. MCP `remember`/`recall` always targets `.memory/memory.jsonl`.**
171
+
172
+ ### Memory Isolation
173
+
174
+ - Each project has its own `.memory/memory.jsonl` (configured via `.mcp.json`)
175
+ - Global fallback: `~/.anhdh/memory/global.json` (neutral, for cross-project knowledge)
176
+ - `.mcp.json` per project overrides global config → no data leakage between projects