@praneeth_54/agentdoctor 2.0.0 → 2.1.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 (168) hide show
  1. package/CHANGELOG.md +141 -4
  2. package/README.md +329 -153
  3. package/dist/agent/approvals.d.ts +24 -0
  4. package/dist/agent/approvals.js +64 -0
  5. package/dist/agent/chat/index.d.ts +7 -0
  6. package/dist/agent/chat/index.js +5 -0
  7. package/dist/agent/chat/memory.d.ts +44 -0
  8. package/dist/agent/chat/memory.js +103 -0
  9. package/dist/agent/chat/project-summary.d.ts +16 -0
  10. package/dist/agent/chat/project-summary.js +70 -0
  11. package/dist/agent/chat/prompts.d.ts +6 -0
  12. package/dist/agent/chat/prompts.js +39 -0
  13. package/dist/agent/chat/response.d.ts +19 -0
  14. package/dist/agent/chat/response.js +109 -0
  15. package/dist/agent/chat/service.d.ts +42 -0
  16. package/dist/agent/chat/service.js +252 -0
  17. package/dist/agent/chat/types.d.ts +48 -0
  18. package/dist/agent/chat/types.js +1 -0
  19. package/dist/agent/context/retrieve.d.ts +21 -0
  20. package/dist/agent/context/retrieve.js +117 -0
  21. package/dist/agent/context/truth.d.ts +6 -0
  22. package/dist/agent/context/truth.js +19 -0
  23. package/dist/agent/context/types.d.ts +23 -0
  24. package/dist/agent/context/types.js +4 -0
  25. package/dist/agent/index.d.ts +26 -0
  26. package/dist/agent/index.js +14 -0
  27. package/dist/agent/loop.d.ts +51 -0
  28. package/dist/agent/loop.js +222 -0
  29. package/dist/agent/modes.d.ts +18 -0
  30. package/dist/agent/modes.js +102 -0
  31. package/dist/agent/plan.d.ts +30 -0
  32. package/dist/agent/plan.js +121 -0
  33. package/dist/agent/runtime.d.ts +67 -0
  34. package/dist/agent/runtime.js +180 -0
  35. package/dist/agent/state.d.ts +30 -0
  36. package/dist/agent/state.js +95 -0
  37. package/dist/agent/student.d.ts +56 -0
  38. package/dist/agent/student.js +230 -0
  39. package/dist/agent/tools/execute.d.ts +18 -0
  40. package/dist/agent/tools/execute.js +355 -0
  41. package/dist/agent/tools/index.d.ts +6 -0
  42. package/dist/agent/tools/index.js +5 -0
  43. package/dist/agent/tools/registry.d.ts +7 -0
  44. package/dist/agent/tools/registry.js +212 -0
  45. package/dist/agent/tools/run.d.ts +24 -0
  46. package/dist/agent/tools/run.js +44 -0
  47. package/dist/agent/tools/types.d.ts +32 -0
  48. package/dist/agent/tools/types.js +10 -0
  49. package/dist/agent/tools/write.d.ts +24 -0
  50. package/dist/agent/tools/write.js +121 -0
  51. package/dist/agent/verify.d.ts +29 -0
  52. package/dist/agent/verify.js +210 -0
  53. package/dist/ai/config.d.ts +22 -0
  54. package/dist/ai/config.js +68 -0
  55. package/dist/ai/index.d.ts +17 -0
  56. package/dist/ai/index.js +52 -0
  57. package/dist/ai/providers/mock.d.ts +20 -0
  58. package/dist/ai/providers/mock.js +84 -0
  59. package/dist/ai/providers/none.d.ts +6 -0
  60. package/dist/ai/providers/none.js +23 -0
  61. package/dist/ai/providers/openai-compatible.d.ts +21 -0
  62. package/dist/ai/providers/openai-compatible.js +151 -0
  63. package/dist/ai/redact.d.ts +8 -0
  64. package/dist/ai/redact.js +21 -0
  65. package/dist/ai/types.d.ts +71 -0
  66. package/dist/ai/types.js +6 -0
  67. package/dist/architecture/contract.d.ts +64 -0
  68. package/dist/architecture/contract.js +373 -0
  69. package/dist/assurance/change.d.ts +211 -0
  70. package/dist/assurance/change.js +624 -0
  71. package/dist/assurance/proof.d.ts +136 -0
  72. package/dist/assurance/proof.js +338 -0
  73. package/dist/auth/index.d.ts +81 -0
  74. package/dist/auth/index.js +130 -0
  75. package/dist/auth/rbac.d.ts +9 -0
  76. package/dist/auth/rbac.js +26 -0
  77. package/dist/cli/commands/agent.d.ts +27 -0
  78. package/dist/cli/commands/agent.js +153 -0
  79. package/dist/cli/commands/architecture.d.ts +6 -0
  80. package/dist/cli/commands/architecture.js +109 -0
  81. package/dist/cli/commands/assurance.d.ts +67 -0
  82. package/dist/cli/commands/assurance.js +210 -0
  83. package/dist/cli/commands/chat.d.ts +14 -0
  84. package/dist/cli/commands/chat.js +155 -0
  85. package/dist/cli/commands/complete.js +2 -2
  86. package/dist/cli/commands/learn.d.ts +12 -0
  87. package/dist/cli/commands/learn.js +107 -0
  88. package/dist/cli/commands/platform.d.ts +2 -0
  89. package/dist/cli/commands/platform.js +5 -1
  90. package/dist/cli/commands/policy-graph-run.d.ts +40 -0
  91. package/dist/cli/commands/policy-graph-run.js +200 -0
  92. package/dist/cli/commands/workspace.d.ts +9 -0
  93. package/dist/cli/commands/workspace.js +82 -0
  94. package/dist/cli/program.js +627 -17
  95. package/dist/constants.d.ts +1 -1
  96. package/dist/constants.js +1 -1
  97. package/dist/contracts/index.d.ts +1 -1
  98. package/dist/contracts/index.js +2 -2
  99. package/dist/core/brain-product/init.js +5 -2
  100. package/dist/core/secrets/scan.d.ts +7 -1
  101. package/dist/core/secrets/scan.js +9 -9
  102. package/dist/coverage/cobertura.d.ts +6 -0
  103. package/dist/coverage/cobertura.js +52 -0
  104. package/dist/coverage/istanbul.d.ts +7 -0
  105. package/dist/coverage/istanbul.js +134 -0
  106. package/dist/coverage/lcov.d.ts +7 -0
  107. package/dist/coverage/lcov.js +59 -0
  108. package/dist/coverage/load.d.ts +9 -0
  109. package/dist/coverage/load.js +39 -0
  110. package/dist/coverage/types.d.ts +23 -0
  111. package/dist/coverage/types.js +5 -0
  112. package/dist/dashboard/server.d.ts +7 -1
  113. package/dist/dashboard/server.js +110 -6
  114. package/dist/enforcement/runner.d.ts +52 -3
  115. package/dist/enforcement/runner.js +467 -16
  116. package/dist/index.d.ts +36 -2
  117. package/dist/index.js +23 -2
  118. package/dist/intelligence/graph/build.d.ts +2 -0
  119. package/dist/intelligence/graph/build.js +49 -5
  120. package/dist/intelligence/graph/incremental.d.ts +68 -0
  121. package/dist/intelligence/graph/incremental.js +234 -0
  122. package/dist/intelligence/resolve/imports.d.ts +36 -0
  123. package/dist/intelligence/resolve/imports.js +245 -0
  124. package/dist/languages/go.d.ts +9 -0
  125. package/dist/languages/go.js +50 -0
  126. package/dist/languages/index.d.ts +11 -0
  127. package/dist/languages/index.js +76 -0
  128. package/dist/languages/php.d.ts +8 -0
  129. package/dist/languages/php.js +202 -0
  130. package/dist/languages/python.d.ts +11 -0
  131. package/dist/languages/python.js +180 -0
  132. package/dist/languages/types.d.ts +42 -0
  133. package/dist/languages/types.js +26 -0
  134. package/dist/languages/typescript.d.ts +3 -0
  135. package/dist/languages/typescript.js +95 -0
  136. package/dist/mcp/agent/registry.d.ts +13 -0
  137. package/dist/mcp/agent/registry.js +234 -0
  138. package/dist/mcp/agentdoctor/server.js +8 -1
  139. package/dist/mcp/intelligence/handlers.d.ts +5 -0
  140. package/dist/mcp/intelligence/handlers.js +229 -40
  141. package/dist/mcp/intelligence/path-safety.d.ts +2 -4
  142. package/dist/mcp/intelligence/path-safety.js +25 -44
  143. package/dist/mcp/intelligence/registry.d.ts +1 -1
  144. package/dist/mcp/intelligence/registry.js +69 -1
  145. package/dist/platform/firewall/evaluate.d.ts +6 -3
  146. package/dist/platform/firewall/evaluate.js +66 -15
  147. package/dist/platform/graph/build.js +19 -23
  148. package/dist/platform/health/analyze.js +23 -17
  149. package/dist/platform/index.js +2 -0
  150. package/dist/platform/test-impact/analyze.d.ts +21 -3
  151. package/dist/platform/test-impact/analyze.js +214 -28
  152. package/dist/platform/tokens/plan.js +39 -20
  153. package/dist/platform/types.d.ts +9 -0
  154. package/dist/policy/compose.d.ts +34 -0
  155. package/dist/policy/compose.js +118 -0
  156. package/dist/policy/packs.js +33 -1
  157. package/dist/security/paths.d.ts +21 -0
  158. package/dist/security/paths.js +133 -0
  159. package/dist/storage/postgres.d.ts +26 -0
  160. package/dist/storage/postgres.js +90 -0
  161. package/dist/storage/provider.d.ts +2 -7
  162. package/dist/storage/provider.js +22 -16
  163. package/dist/storage/sqlite.d.ts +33 -0
  164. package/dist/storage/sqlite.js +77 -0
  165. package/dist/team/auth.js +1 -1
  166. package/dist/workspace/index.d.ts +69 -0
  167. package/dist/workspace/index.js +220 -0
  168. package/package.json +9 -3
package/README.md CHANGED
@@ -1,266 +1,442 @@
1
1
  # AgentDoctor
2
2
 
3
- **Codebase intelligence for developers, agents, and engineering teams.**
3
+ ## Engineering assurance for AI coding agents.
4
4
 
5
- Local-first tooling that helps you understand a repository, keep AI coding agents safer, and query evidence-backed project knowledge — without requiring a cloud account or API key.
5
+ Understand your codebase, assess the impact of changes, govern engineering knowledge, enforce safety policies, and attach inspectable evidence to AI-driven changes.
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/@praneeth_54/agentdoctor?label=npm)](https://www.npmjs.com/package/@praneeth_54/agentdoctor)
8
8
  [![CI](https://img.shields.io/github/actions/workflow/status/pranee54/AgentDoctor/ci.yml?branch=main&label=CI)](https://github.com/pranee54/AgentDoctor/actions/workflows/ci.yml)
9
9
  [![Node](https://img.shields.io/node/v/@praneeth_54/agentdoctor)](https://nodejs.org)
10
10
  [![License](https://img.shields.io/github/license/pranee54/AgentDoctor)](LICENSE)
11
11
 
12
- **Published package:** `@praneeth_54/agentdoctor@`**2.0.0**
12
+ **Published:** [`@praneeth_54/agentdoctor@2.1.0`](https://www.npmjs.com/package/@praneeth_54/agentdoctor)
13
+ **Release notes:** [docs/RELEASE_2_1_0.md](docs/RELEASE_2_1_0.md) · Prior assurance cut: [docs/2.0.1/README.md](docs/2.0.1/README.md)
13
14
 
14
- [Documentation index](docs/README.md) · [AgentDoctor 2.0 docs](docs/2.0/README.md) · [Known limitations](docs/2.0/overview/known-limitations.md) · [Readiness matrix](docs/2.0/overview/readiness-matrix.md) · [Security](SECURITY.md) · [Changelog](CHANGELOG.md)
15
+ [Install](#install) · [Quickstart](#quickstart) · [Change assurance](#change-assurance) · [Project AI (2.1)](#project-ai-agent-21) · [Documentation](docs/2.0.1/README.md) · [MCP](#mcp) · [GitHub Action](#github-action) · [Architecture](#architecture)
15
16
 
16
17
  ---
17
18
 
18
- ## What AgentDoctor does
19
+ ## What AgentDoctor is
19
20
 
20
- AgentDoctor combines three complementary layers:
21
+ AgentDoctor sits between developers / AI coding agents and the repository’s engineering reality.
21
22
 
22
- 1. **Safety** — audit and safely fix AI coding-agent configuration (scan → fix → verify → policy → CI).
23
- 2. **Repository Brain** — evidence-backed claims, proposals, human review, and Project Brain MCP tools.
24
- 3. **Codebase intelligence** — TypeScript/JavaScript AST graphs, git hotspots, impact analysis, knowledge governance, evaluate-only policy, and a combined MCP server.
23
+ AI agents can write code quickly. The harder engineering problem is knowing whether a change is **correct, safe, compatible, explainable, and consistent** with the rest of the repository.
25
24
 
26
- It is **not** an autonomous coding agent, chatbot, or IDE process interceptor. It does **not** block Cursor/Claude/Codex unless you deliberately run commands through AgentDoctor’s controlled runner.
25
+ AgentDoctor collects repository signals — source structure, graphs, Git history, policies, knowledge, and verification evidence — so humans and agents can reason about changes with fewer unsupported assumptions.
27
26
 
28
- ---
27
+ **Who it is for**
29
28
 
30
- ## Install
29
+ | Audience | How AgentDoctor helps |
30
+ | ---------------------- | ----------------------------------------------------------------------------- |
31
+ | Manual developers | Scan / fix / verify, change impact, evidence, architecture and policy checks |
32
+ | Students | `learn` — explain project, viva, docs; **BUILD_WITH_ME** after approval |
33
+ | AI-assisted developers | Optional Project Chat (`ask` / `chat`) with evidence and truth labels |
34
+ | AI coding agents | MCP + controlled tools; AgentDoctor owns context, execution, and verification |
31
35
 
32
- ```bash
33
- npm install -g @praneeth_54/agentdoctor
34
- # or
35
- npx @praneeth_54/agentdoctor --help
36
+ It is **not** a generic chatbot, IDE interceptor, or claim of full autonomy. Optional Project AI (2.1) is **opt-in** and still subject to approvals, path/runner controls, and verification. It does **not** guarantee correctness. It produces **evidence and controls** you can inspect.
37
+
38
+ **Architecture (when AI is enabled):**
39
+
40
+ ```text
41
+ THE MODEL REASONS.
42
+ AGENTDOCTOR PROVIDES PROJECT CONTEXT.
43
+ AGENTDOCTOR CONTROLS TOOLS.
44
+ AGENTDOCTOR VERIFIES RESULTS.
36
45
  ```
37
46
 
38
- Requires **Node.js 20+**. The runtime depends on the TypeScript compiler API for AST analysis.
47
+ **Short description:** Engineering assurance for AI coding agents — repository intelligence, change evidence, safety controls, MCP tools, and an optional Project AI Agent.
39
48
 
40
49
  ---
41
50
 
42
- ## Quick start
51
+ ## Why AgentDoctor?
52
+
53
+ Modern AI coding agents can:
54
+
55
+ - read individual files
56
+ - generate and edit code
57
+ - run tests when asked
58
+
59
+ Repository-level context is usually fragmented across:
60
+
61
+ | Signal | Typical location |
62
+ | ------------------ | ------------------------------ |
63
+ | Source structure | AST / imports / modules |
64
+ | Dependencies | manifests / lockfiles |
65
+ | History | Git |
66
+ | Architecture | docs / conventions / inference |
67
+ | Tests | test trees / naming heuristics |
68
+ | Policy | CI rules / allowlists |
69
+ | Decisions | ADRs / RFCs / tribal knowledge |
70
+ | Secrets / exposure | config files / ignore rules |
71
+
72
+ AgentDoctor brings those signals into one local toolchain around an AI-driven engineering change:
73
+
74
+ ```text
75
+ Developer / AI Agent
76
+ │
77
+ ▼
78
+ AgentDoctor
79
+ │
80
+ ┌───────────────────────────────┐
81
+ │ Repository Intelligence │
82
+ │ AST / Graph / Git / Impact │
83
+ ├───────────────────────────────┤
84
+ │ Engineering Knowledge │
85
+ │ Brain / Decisions / Provenance│
86
+ ├───────────────────────────────┤
87
+ │ Safety & Policy │
88
+ │ Scan / Fix / Enforce / Secrets│
89
+ ├───────────────────────────────┤
90
+ │ Verification │
91
+ │ Tests / Reports / Evidence │
92
+ └───────────────────────────────┘
93
+ │
94
+ ▼
95
+ Safer, explainable engineering decisions
96
+ ```
43
97
 
44
- ```bash
45
- # Safety loop
46
- agentdoctor scan
47
- agentdoctor fix --dry-run
48
- agentdoctor verify --baseline agentdoctor-report.json
98
+ ---
49
99
 
50
- # Repository Brain proposals (never auto-approved)
51
- agentdoctor init --name "My App" --domain "payments"
52
- agentdoctor brain proposals
53
- agentdoctor brain review --artifact <id> --decision approved
100
+ ## Capability map
54
101
 
55
- # Intelligence
56
- agentdoctor graph --mode auto --json
57
- agentdoctor health --json
58
- agentdoctor c4 --json
59
- agentdoctor impact --json
60
- agentdoctor refactor-impact --symbol MySymbol --json
102
+ Status labels: **SUPPORTED** · **PARTIAL** · **EXPERIMENTAL** · **NOT YET SUPPORTED**
61
103
 
62
- # Knowledge (draft → human approve)
63
- agentdoctor knowledge-create --title "Standard" --content "…"
64
- agentdoctor knowledge-approve --id <id> --decision approved
104
+ Details and evidence: [docs/2.0/overview/capabilities.md](docs/2.0/overview/capabilities.md) · [readiness matrix](docs/2.0/overview/readiness-matrix.md)
65
105
 
66
- # Policy (evaluate-only by default)
67
- agentdoctor enforce --command "npm test" --json
106
+ ### Repository intelligence
68
107
 
69
- # MCP (Brain tools preserved; combined server adds intelligence tools)
70
- agentdoctor brain-mcp --root /ABS/PATH/TO/REPO
71
- agentdoctor mcp --root /ABS/PATH/TO/REPO
108
+ | Capability | Status |
109
+ | ---------------------------------------------------- | ------------ |
110
+ | TypeScript / JavaScript AST graph (+ regex fallback) | PARTIAL |
111
+ | Import / inferred call relationships | PARTIAL |
112
+ | Git hotspot / engineering intelligence | PARTIAL |
113
+ | Change / test / refactor impact | PARTIAL |
114
+ | C4-style architecture views | EXPERIMENTAL |
72
115
 
73
- # Local dashboard (loopback)
74
- agentdoctor dashboard
75
- ```
116
+ ### Engineering knowledge
117
+
118
+ | Capability | Status |
119
+ | ------------------------------------------------------------- | --------- |
120
+ | Project Brain store + evidence-backed claims | SUPPORTED |
121
+ | Repository Brain init / proposal review (never auto-approved) | PARTIAL |
122
+ | Governed knowledge + abstention on retrieve | PARTIAL |
123
+ | Provenance envelopes on Brain MCP tools | SUPPORTED |
124
+
125
+ ### Agent interfaces
126
+
127
+ | Capability | Status |
128
+ | --------------------------------------------------------------------------------- | --------- |
129
+ | Brain MCP (`brain_*` tools, STDIO) | SUPPORTED |
130
+ | Combined MCP (Brain + intelligence tools) | PARTIAL |
131
+ | Agent MCP (`project_ask`, path-safe file tools, plan, change verify) — 2.1 | PARTIAL |
132
+ | Optional Project Chat / coding agent CLI (`chat`, `ask`, `agent`, `learn`) — 2.1 | PARTIAL |
133
+ | Agent adapters (Cursor, Claude Code, Codex, Copilot, Windsurf, Gemini CLI, Aider) | SUPPORTED |
134
+ | Local dashboard + `/api/v2/*` + ask-only `/api/chat` — 2.1 | PARTIAL |
135
+ | Programmatic API (`scan`, Fix, Brain helpers) | SUPPORTED |
136
+
137
+ ### Safety & governance
138
+
139
+ | Capability | Status |
140
+ | -------------------------------------------------------- | --------------------- |
141
+ | Scan → Safe Fix → Verify | SUPPORTED |
142
+ | Policy gates (`--min-score`, severity, rule, verify-new) | SUPPORTED |
143
+ | Evaluate-only policy / controlled enforcement runner | PARTIAL |
144
+ | Secret scan (redacted findings) + export redaction | PARTIAL |
145
+ | Path-safety for MCP / dashboard | PARTIAL |
146
+ | Local-dev team auth (scrypt) | PARTIAL — **not SSO** |
147
+
148
+ ### Verification
149
+
150
+ | Capability | Status |
151
+ | ------------------------------------------------------- | -------------------------- |
152
+ | Change assurance assessment + evidence bundles | PARTIAL |
153
+ | Evidence hash verify (`verified` = integrity only) | SUPPORTED |
154
+ | Unit / integration / MCP STDIO tests (`npm run verify`) | SUPPORTED |
155
+ | Packed CLI clean-install smoke | SUPPORTED |
156
+ | Reproducible AST perf harness | PARTIAL (synthetic sample) |
76
157
 
77
158
  ---
78
159
 
79
- ## Capability status (honest)
160
+ ## How AgentDoctor is different
161
+
162
+ Most engineering tools optimize one layer: static analysis, search, docs generation, dashboards, security scanners, or AI chat.
80
163
 
81
- Classifications match [docs/2.0/overview/readiness-matrix.md](docs/2.0/overview/readiness-matrix.md). **No blanket 5/5 claims.**
164
+ AgentDoctor is designed around the **lifecycle of an AI-driven change**:
82
165
 
83
- ### Fully verified (shipped & regression-tested core)
166
+ ```text
167
+ Repository
168
+ → Understand
169
+ → Impact
170
+ → Knowledge
171
+ → Policy
172
+ → Change
173
+ → Verification
174
+ → Evidence
175
+ ```
84
176
 
85
- | Capability | Notes |
86
- | --------------------------------------------------------------------------------- | ---------------------------------------------------------- |
87
- | Safety scan / Safe Fix / verify / policy gates | Exit codes and CI Action preserved |
88
- | Agent adapters (Cursor, Claude Code, Codex, Copilot, Windsurf, Gemini CLI, Aider) | Detect + rules; Safe Fix where official ignore/deny exists |
89
- | Project Brain store + Brain MCP tool names (`brain_*`) | STDIO MCP; `--root` required |
177
+ That combination is the product direction. It does not mean every layer is equally mature — see the capability map and limitations.
90
178
 
91
- ### Partially validated (implemented, tested; accuracy/perf not independently certified)
179
+ ---
92
180
 
93
- | Capability | Entry points |
94
- | ----------------------------------------------- | ------------------------------------------- |
95
- | Repository Brain init / proposal review | `init`, `brain review`, `brain proposals` |
96
- | TS/JS AST intelligence graph (+ regex fallback) | `graph` |
97
- | Git hotspots / bus-factor style metrics | `health` (method disclosed per metric) |
98
- | Impact / test-impact / refactor-impact | `impact`, `test-impact`, `refactor-impact` |
99
- | Knowledge governance + abstention | `knowledge*`; MCP `knowledge_retrieve` |
100
- | Policy packs + controlled enforcement runner | `enforce`, `platform policy-check` |
101
- | Combined MCP (`agentdoctor mcp`) | Brain + intelligence tools |
102
- | Dashboard + `/api/v2/*` | `dashboard` (loopback default) |
103
- | Local-dev team auth (scrypt) | `team-register`, `team-login` — **not SSO** |
181
+ ## Architecture
182
+
183
+ ```text
184
+ AgentDoctor
185
+ │
186
+ ├── Repository Intelligence
187
+ │ ├── AST (TS/JS)
188
+ │ ├── Graph
189
+ │ ├── Git
190
+ │ └── Impact
191
+ │
192
+ ├── Engineering Knowledge
193
+ │ ├── Brain
194
+ │ ├── Governance
195
+ │ └── Provenance
196
+ │
197
+ ├── Safety
198
+ │ ├── Scanner
199
+ │ ├── Safe Fix
200
+ │ ├── Secrets
201
+ │ └── Policies
202
+ │
203
+ ├── Agent Interface
204
+ │ ├── MCP (brain-mcp / mcp)
205
+ │ ├── CLI
206
+ │ ├── API / dashboard
207
+ │ └── Adapters
208
+ │
209
+ └── Verification
210
+ ├── Tests
211
+ ├── Reports
212
+ └── Release validation
213
+ ```
104
214
 
105
- ### Experimental
215
+ Code layout: `src/{intelligence,knowledge,core,mcp,platform,enforcement,cli}/`
106
216
 
107
- | Capability | Notes |
108
- | -------------- | --------------------------------------------------------------------------------- |
109
- | C4-style views | `c4` — **inferred/proposed** from graph evidence, not approved architecture truth |
217
+ Canonical docs: [docs/2.0/overview/architecture.md](docs/2.0/overview/architecture.md)
218
+
219
+ ---
110
220
 
111
- ### Unsupported / not claimed
221
+ ## Engineering principles
112
222
 
113
- | Topic | Status |
114
- | ------------------------------------------------ | -------------------------------------------------- |
115
- | Enterprise SSO / IdP | Not bundled |
116
- | Production SQLite / Postgres / vector search | Flags off / stub only |
117
- | Full multi-language AST (Python, Go, …) | Unsupported |
118
- | Direct IDE interception / agent process blocking | Unsupported |
119
- | Coverage-backed test selection as ground truth | Not bundled (test-impact is heuristic/graph-based) |
223
+ 1. Evidence over assumptions
224
+ 2. Explicit limitations over inflated claims
225
+ 3. Safety before automation
226
+ 4. Repository context over isolated files
227
+ 5. Human approval for governed decisions
228
+ 6. Backwards compatibility where documented
229
+ 7. Reproducible verification
230
+ 8. Explainable agent actions
231
+ 9. Least privilege
232
+ 10. Secure defaults
120
233
 
121
234
  ---
122
235
 
123
- ## Safety (preserved)
236
+ ## Install
124
237
 
125
- Scan agent configs and repository hygiene; apply Safe Fix where supported; verify against a baseline; fail CI on severity/score gates.
238
+ Requires **Node.js 20+**.
126
239
 
127
240
  ```bash
128
- agentdoctor scan --json
129
- agentdoctor fix -y
130
- agentdoctor verify --baseline agentdoctor-report.json
241
+ npm install -g @praneeth_54/agentdoctor@2.1.0
242
+ # or:
243
+ npx @praneeth_54/agentdoctor@2.1.0 --help
131
244
  ```
132
245
 
133
- GitHub Action: pin `pranee54/AgentDoctor@v2.0.0` (default npm version input is `2.0.0`). Surfaces matrix: [docs/reference/surfaces-and-adapters.md](docs/reference/surfaces-and-adapters.md).
246
+ From source:
134
247
 
135
- ```yaml
136
- - uses: pranee54/AgentDoctor@v2.0.0
137
- with:
138
- path: .
139
- version: "2.0.0"
248
+ ```bash
249
+ git clone https://github.com/pranee54/AgentDoctor.git
250
+ cd AgentDoctor
251
+ npm install
252
+ npm run verify
140
253
  ```
141
254
 
142
255
  ---
143
256
 
144
- ## Repository Brain
145
-
146
- `agentdoctor init` writes **PROPOSED** artifacts under `.agentdoctor/repository-brain/proposals/`. They are **not** facts until a human reviews them.
257
+ ## Quickstart
147
258
 
148
259
  ```bash
149
- agentdoctor brain init
150
- agentdoctor brain snapshot
151
- agentdoctor brain review --artifact prop_… --decision approved|rejected
260
+ agentdoctor --version # 2.1.0
261
+ agentdoctor scan .
262
+ agentdoctor scan . --json
263
+ agentdoctor fix --dry-run
264
+ agentdoctor verify --baseline agentdoctor-report.json
265
+
266
+ # Repository Brain proposals (not auto-approved)
267
+ agentdoctor init --name "My App" --domain "payments"
268
+ agentdoctor brain proposals
269
+
270
+ # Intelligence
271
+ agentdoctor graph --mode auto --json
272
+ agentdoctor impact --json
273
+ agentdoctor c4 --json
274
+
275
+ # Change assurance
276
+ agentdoctor change analyze
277
+ agentdoctor change verify
278
+ agentdoctor change explain|diff|status
279
+ agentdoctor evidence inspect <id>
280
+ agentdoctor evidence verify <id>
281
+ agentdoctor proof build|inspect|verify|export <id>
282
+
283
+ # Architecture / policy / controlled run
284
+ agentdoctor architecture init|check|explain
285
+ agentdoctor policy check|explain --command "npm test"
286
+ agentdoctor run explain --command "npm test"
287
+ agentdoctor workspace create|add|list|status|remove
288
+
289
+ # MCP (absolute --root required)
290
+ agentdoctor brain-mcp --root /ABS/PATH/TO/REPO
291
+ agentdoctor mcp --root /ABS/PATH/TO/REPO
152
292
  ```
153
293
 
154
- Guide: [docs/2.0/guides/repository-brain.md](docs/2.0/guides/repository-brain.md).
294
+ ### Project AI Agent (2.1 — optional; local RC)
155
295
 
156
- ---
296
+ Requires an explicit provider (`AGENTDOCTOR_AI_PROVIDER=mock` or openai-compatible / ollama). Default `none` fails closed for chat.
157
297
 
158
- ## Codebase intelligence
298
+ ```bash
299
+ agentdoctor ask "How does login work?" .
300
+ agentdoctor chat .
301
+ agentdoctor learn .
302
+ agentdoctor learn --viva
303
+ agentdoctor plan "Add registration"
304
+ # Writes require --approve; model cannot self-approve
305
+ agentdoctor agent --goal "Add registration" --approve --apply --apply-ops '[...]' .
306
+ ```
159
307
 
160
- - **AST graph** — TypeScript/JavaScript via the TypeScript compiler API; regex fallback when needed (`graph --mode auto|typescript-ast|regex`).
161
- - **Git intelligence** — recent-window hotspots / co-change heuristics with method disclosure (`health`).
162
- - **C4 views** — inferred diagrams (`c4`); label them proposed/inferred.
163
- - **Impact** — change/test/refactor blast-radius helpers (`impact`, `refactor-impact`).
308
+ Details: [docs/RELEASE_2_1_0.md](docs/RELEASE_2_1_0.md) · [docs/AI_AGENT.md](docs/AI_AGENT.md) · [docs/SECURITY_AGENT.md](docs/SECURITY_AGENT.md)
164
309
 
165
- Limitations: call resolution is best-effort; non-TS languages are not deeply analyzed.
310
+ CLI reference: [docs/2.0/guides/cli.md](docs/2.0/guides/cli.md) · Change assurance: [docs/2.0.1/change-assurance.md](docs/2.0.1/change-assurance.md)
166
311
 
167
312
  ---
168
313
 
169
- ## Knowledge governance
314
+ ## Project AI Agent (2.1)
315
+
316
+ Optional Project AI on top of the 2.0.1 assurance substrate. See [docs/RELEASE_2_1_0.md](docs/RELEASE_2_1_0.md).
170
317
 
171
- Draft → pending-review → approved/rejected. Retrieval **abstains** when no approved record matches.
318
+ | Piece | Behavior |
319
+ | --------- | ------------------------------------------------------------------------- |
320
+ | Context | Project evidence with truth labels; repository text is untrusted DATA |
321
+ | Tools | Path-safe read/write; commands only via controlled runner (`shell=false`) |
322
+ | Approvals | Human/caller `--approve` required for writes; LEARN mode cannot write |
323
+ | Verify | Change / evidence / proof signals; `ENGINEERING_CORRECTNESS_NOT_CLAIMED` |
324
+ | Limits | Tool calls, iterations, wall time, files modified, context size |
172
325
 
173
- Guide: [docs/2.0/guides/knowledge-governance.md](docs/2.0/guides/knowledge-governance.md).
326
+ Limitations: not an OS sandbox; native Anthropic/Gemini SDKs not implemented; MCP `approved=true` is trusted-caller input (not cryptographic identity); correctness never guaranteed.
174
327
 
175
328
  ---
176
329
 
177
- ## Policy evaluation and controlled enforcement
330
+ ## Change assurance
331
+
332
+ Structured assessment, evidence bundles, and Change Proof **integrity** (not engineering correctness). Optional `--coverage` for coverage-backed / hybrid test impact. See [docs/2.0.1/FINAL_COMPLETION_AUDIT.md](docs/2.0.1/FINAL_COMPLETION_AUDIT.md).
178
333
 
179
- | Mode | Behavior |
180
- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
181
- | Policy evaluation (`platform policy-check`, MCP `policy_evaluate`) | Verdict only; `executionResult: "not-executed"` |
182
- | Controlled runner (`enforce`) | Can report `blocked-by-enforcement` when **AgentDoctor** refuses to run a blocked command |
183
- | Third-party IDEs | **Not** intercepted |
334
+ ```bash
335
+ agentdoctor change analyze # ChangeAssessment (verificationStatus: not-run)
336
+ agentdoctor change verify # write .agentdoctor/evidence/<id>/ (evidence-produced)
337
+ agentdoctor change explain|diff|status
338
+ agentdoctor evidence inspect <id> # list artifacts + manifest
339
+ agentdoctor evidence verify <id> # SHA-256 check; verified only if all hashes match
340
+ agentdoctor proof inspect|verify <id> # integrity; correctnessStatus always NOT_CLAIMED
341
+ ```
184
342
 
185
- Trust boundaries: [docs/2.0/overview/trust-boundaries.md](docs/2.0/overview/trust-boundaries.md).
343
+ `verified` means artifact integrity against the manifest — not that the change is correct or safe. Details: [docs/2.0.1/change-assurance.md](docs/2.0.1/change-assurance.md) · [docs/2.0.1/evidence.md](docs/2.0.1/evidence.md)
186
344
 
187
345
  ---
188
346
 
189
347
  ## MCP
190
348
 
191
- | Command | Server | Tools |
192
- | ------------------------------------- | ---------- | -------------------------- |
193
- | `agentdoctor brain-mcp --root <path>` | Brain only | Stable `brain_*` names |
194
- | `agentdoctor mcp --root <path>` | Combined | Brain + intelligence tools |
349
+ AgentDoctor exposes local **STDIO** MCP servers (no API key).
195
350
 
196
- MCP docs: [docs/2.0/guides/mcp.md](docs/2.0/guides/mcp.md) · legacy detail: [docs/mcp/brain-mcp.md](docs/mcp/brain-mcp.md).
351
+ | Server | Command | Tools |
352
+ | ------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
353
+ | Brain MCP | `agentdoctor brain-mcp --root <abs>` | `brain_overview`, `brain_query`, `brain_explain`, `brain_trace`, `brain_claims`, `brain_evidence`, `brain_ownership`, `brain_risk`, `brain_delta`, `brain_snapshot` |
354
+ | Combined MCP | `agentdoctor mcp --root <abs>` | All `brain_*` tools **plus** intelligence tools below |
355
+
356
+ Intelligence tools (combined MCP):
357
+ `repo_overview`, `codebase_search`, `symbol_lookup`, `dependency_lookup`, `call_graph_lookup`, `test_impact`, `refactor_impact`, `code_health`, `architecture_info`, `architecture_check`, `knowledge_retrieve`, `policy_evaluate`, `change_analyze`, `proof_inspect`, `evidence_inspect`, `graph_query`
358
+
359
+ Guide: [docs/2.0/guides/mcp.md](docs/2.0/guides/mcp.md) · Deep Brain MCP: [docs/mcp/brain-mcp.md](docs/mcp/brain-mcp.md)
197
360
 
198
361
  ---
199
362
 
200
- ## CLI / API / dashboard
363
+ ## GitHub Action
201
364
 
202
- - CLI index: [docs/2.0/guides/cli.md](docs/2.0/guides/cli.md)
203
- - HTTP API (local dashboard): [docs/2.0/guides/api.md](docs/2.0/guides/api.md)
204
- - Dashboard defaults to `127.0.0.1`; `?user=` role selection is **not** authentication
365
+ Use AgentDoctor Safety in CI for scan / verify gates. Default npm version input is **`2.1.0`**.
205
366
 
206
- ```bash
207
- agentdoctor dashboard
208
- agentdoctor doctor --json
367
+ ```yaml
368
+ - uses: pranee54/AgentDoctor@v2.1.0
369
+ with:
370
+ path: .
371
+ version: "2.1.0"
372
+ fail-on-severity: critical
209
373
  ```
210
374
 
375
+ For repository CI against the checked-out build: `version: workspace` (requires `dist/` from `npm run build`).
376
+
377
+ Guide: [docs/2.0/guides/github-action.md](docs/2.0/guides/github-action.md) · Action metadata: [`action.yml`](action.yml)
378
+
379
+ Marketplace listing: confirm in the GitHub UI if you need Marketplace discovery beyond the Action in this repository.
380
+
211
381
  ---
212
382
 
213
- ## Local-development team authentication
383
+ ## Security model
214
384
 
215
- ```bash
216
- agentdoctor team-register --username alice --password '………'
217
- agentdoctor team-login --username alice --password '………'
218
- ```
385
+ | Control | Behavior |
386
+ | ----------- | -------------------------------------------------------------------------- |
387
+ | Path safety | MCP / dashboard reject traversal, encoded escapes, hostile URLs |
388
+ | Safe Fix | Preflight targets; refuse symlink write-through / non-allowlisted paths |
389
+ | Secrets | Opt-in scan; findings and exports redact sensitive patterns |
390
+ | Policy | Evaluate-only by default (`executionResult: "not-executed"`) |
391
+ | Enforcement | Controlled runner blocks; does **not** claim IDE interception |
392
+ | Dashboard | Loopback by default; non-loopback requires explicit opt-in |
393
+ | Team auth | Local-dev scrypt + optional OIDC JWT validation — **not** full browser SSO |
219
394
 
220
- This is **local-dev scrypt auth**, clearly labeled — **not** enterprise SSO.
395
+ Threat model: [docs/2.0/overview/security-threat-model.md](docs/2.0/overview/security-threat-model.md) · Trust boundaries: [docs/2.0/overview/trust-boundaries.md](docs/2.0/overview/trust-boundaries.md)
221
396
 
222
397
  ---
223
398
 
224
- ## Important limitations (read before adopting)
399
+ ## What AgentDoctor does not do
225
400
 
226
- 1. AST depth is **TypeScript/JavaScript**-oriented.
227
- 2. Test-impact is **heuristic / graph-based**, not coverage-oracle accurate.
228
- 3. C4 views are **inferred**, not approved architecture.
229
- 4. Firewall is **evaluate-only** unless you use AgentDoctor’s controlled runner.
230
- 5. Team auth is **local-dev**, not SSO.
231
- 6. No IDE interception.
232
- 7. No production SQLite/Postgres/vector backend in this package.
233
- 8. No complete multi-language AST.
234
- 9. Deep 2.0 audits and readiness reports live on GitHub under [docs/2.0/](docs/2.0/README.md) (not inside the npm tarball — packaging Option B).
401
+ - Full browser OAuth / production IdP login UX (JWT validation library path exists; redirect flow is experimental)
402
+ - Complete multi-language AST (Java / Kotlin / Rust / Dart / Go extractors external or unsupported)
403
+ - Coverage as universal ground truth without a coverage file / test map
404
+ - IDE / agent process interception (external host APIs)
405
+ - Production multi-tenant cloud / managed hosting in this package
406
+ - Guaranteed autonomous command execution of “allowed” policies
407
+ - Treating inferred C4 / heuristic impact as approved architecture truth
408
+ - Shipping full `docs/2.0.1/` inside the npm tarball (Option B: README + GitHub docs)
235
409
 
236
- Full list: [docs/2.0/overview/known-limitations.md](docs/2.0/overview/known-limitations.md).
410
+ Full list: [docs/2.0.1/limitations.md](docs/2.0.1/limitations.md) · [docs/2.0/overview/known-limitations.md](docs/2.0/overview/known-limitations.md)
237
411
 
238
412
  ---
239
413
 
240
- ## Compatibility
414
+ ## Roadmap note: Change Proof
415
+
416
+ Change assessment, evidence, and proof **integrity** shipped in 2.0.1. `correctnessStatus` is always `ENGINEERING_CORRECTNESS_NOT_CLAIMED`. Broader compliance / team-scale proof UX remains planned.
241
417
 
242
- - Safety CLI exit codes and Brain MCP tool names are preserved.
243
- - Additive 2.0 commands do not remove 1.x workflows.
244
- - Migration notes: [docs/2.0/guides/migration.md](docs/2.0/guides/migration.md).
418
+ See [ROADMAP.md](ROADMAP.md) · [docs/2.0.1/limitations.md](docs/2.0.1/limitations.md) · [docs/2.0.1/FINAL_COMPLETION_AUDIT.md](docs/2.0.1/FINAL_COMPLETION_AUDIT.md).
245
419
 
246
420
  ---
247
421
 
248
422
  ## Documentation map
249
423
 
250
- | Area | Link |
251
- | ---------------- | -------------------------------------------------------------------------- |
252
- | 2.0 index | [docs/2.0/README.md](docs/2.0/README.md) |
253
- | CLI / MCP / API | [docs/2.0/guides/](docs/2.0/guides/) |
254
- | Release blockers | [docs/2.0/audits/release-blockers.md](docs/2.0/audits/release-blockers.md) |
255
- | Docs hub | [docs/README.md](docs/README.md) |
256
- | Changelog | [CHANGELOG.md](CHANGELOG.md) |
257
- | Contributing | [CONTRIBUTING.md](CONTRIBUTING.md) |
424
+ | Audience | Start here |
425
+ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
426
+ | Product / 2.0.1 | [docs/2.0.1/README.md](docs/2.0.1/README.md) |
427
+ | Product / 2.0 | [docs/2.0/README.md](docs/2.0/README.md) |
428
+ | Capabilities / readiness | [capabilities](docs/2.0/overview/capabilities.md) · [readiness](docs/2.0/overview/readiness-matrix.md) |
429
+ | Guides | [docs/2.0/guides/](docs/2.0/guides/) |
430
+ | Reference (rules, scoring, exit codes) | [docs/reference/](docs/reference/) |
431
+ | Contributing | [CONTRIBUTING.md](CONTRIBUTING.md) · [docs/development/development.md](docs/development/development.md) |
432
+ | Changelog | [CHANGELOG.md](CHANGELOG.md) |
433
+ | Release evidence | [FINAL_RELEASE_AUDIT](docs/2.0.1/FINAL_RELEASE_AUDIT.md) · [FINAL_COMPLETION_AUDIT](docs/2.0.1/FINAL_COMPLETION_AUDIT.md) |
258
434
 
259
435
  ---
260
436
 
261
437
  ## Contributing
262
438
 
263
- See [CONTRIBUTING.md](CONTRIBUTING.md) and [docs/development/development.md](docs/development/development.md).
439
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Prefer evidence-backed PRs, honest status labels, and no inflated capability claims.
264
440
 
265
441
  ---
266
442
 
@@ -0,0 +1,24 @@
1
+ import type { AgentRiskLevel, AgentToolName } from "./tools/types.js";
2
+ export type ApprovalDecision = "allow" | "deny" | "require-approval";
3
+ export interface ApprovalRequest {
4
+ action: string;
5
+ risk: AgentRiskLevel;
6
+ toolName?: AgentToolName;
7
+ detail?: string;
8
+ }
9
+ export interface ApprovalResult {
10
+ decision: ApprovalDecision;
11
+ risk: AgentRiskLevel;
12
+ reason: string;
13
+ /** True when a human must confirm before continuing */
14
+ needsHumanApproval: boolean;
15
+ }
16
+ /**
17
+ * Risk-based approval gate. The model cannot approve its own actions.
18
+ * Human approval is represented by an explicit `approvedByHuman` flag from CLI/UI.
19
+ */
20
+ export declare function evaluateApproval(request: ApprovalRequest, options?: {
21
+ approvedByHuman?: boolean;
22
+ allowAutoLow?: boolean;
23
+ }): ApprovalResult;
24
+ export declare function formatApprovalPrompt(request: ApprovalRequest, result: ApprovalResult): string;