project-atlas 0.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 (43) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/CONTRIBUTING.md +57 -0
  3. package/LICENSE +21 -0
  4. package/README.md +305 -0
  5. package/SECURITY.md +28 -0
  6. package/adapters/claude-code/README.md +27 -0
  7. package/adapters/continue/README.md +16 -0
  8. package/adapters/cursor/README.md +29 -0
  9. package/adapters/opencode/README.md +37 -0
  10. package/adapters/opencode/commands/kb-context.md +5 -0
  11. package/adapters/opencode/commands/kb-refresh.md +11 -0
  12. package/adapters/opencode/skills/project-atlas/SKILL.md +15 -0
  13. package/adapters/opencode/tools/project_atlas_context.js +37 -0
  14. package/adapters/opencode/tools/project_atlas_propose.js +53 -0
  15. package/adapters/opencode/tools/project_atlas_scan.js +34 -0
  16. package/dist/core.js +1395 -0
  17. package/dist/frontmatter.js +103 -0
  18. package/dist/index.js +7 -0
  19. package/dist/mcp.js +172 -0
  20. package/dist/scanner.js +128 -0
  21. package/dist/types.js +1 -0
  22. package/dist/utils.js +174 -0
  23. package/docs/site/README.md +47 -0
  24. package/docs/site/agent-quickstart.md +243 -0
  25. package/docs/site/best-practices.md +87 -0
  26. package/docs/site/en/README.md +49 -0
  27. package/docs/site/en/agent-quickstart.md +191 -0
  28. package/docs/site/en/quick-start.md +79 -0
  29. package/docs/site/publish-now.md +166 -0
  30. package/docs/site/quick-start.md +128 -0
  31. package/docs/site/release-process.md +94 -0
  32. package/docs/site/security-faq.md +55 -0
  33. package/docs/site/team-rollout.md +59 -0
  34. package/package.json +55 -0
  35. package/schema/context-pack.schema.json +80 -0
  36. package/schema/external-evidence.schema.json +84 -0
  37. package/schema/manifest.schema.json +28 -0
  38. package/schema/memory-candidate.schema.json +76 -0
  39. package/schema/proposal.schema.json +122 -0
  40. package/schema/trigger-result.schema.json +47 -0
  41. package/templates/frontend-app/README.md +5 -0
  42. package/templates/generic-service/README.md +5 -0
  43. package/templates/java-backend/README.md +5 -0
@@ -0,0 +1,243 @@
1
+ # Agent Quickstart
2
+
3
+ This document is for AI coding agents. Its purpose is to make Project Atlas usable in the first 60 seconds of a task.
4
+
5
+ Agents should read governed project knowledge before broad source exploration, check whether the knowledge base is healthy, and create reviewable proposals when durable knowledge should change.
6
+
7
+ ## Rules
8
+
9
+ - Read Project Atlas before broad source exploration.
10
+ - Default to read-only commands.
11
+ - You may run `context`, `check`, `scan`, `stale`, and `review-summary`.
12
+ - You may run `propose` and `remember` to create proposals.
13
+ - Do not run `project-atlas apply`.
14
+ - Do not configure `project-atlas apply` as an MCP tool, agent tool, hook, or automatic script.
15
+ - If `knowledge/manifest.json` is missing, do not silently initialize the repository. Tell the user and provide the init command.
16
+ - When answering, list the knowledge files used, commands run, and anything that still needs human review.
17
+
18
+ ## First Probe
19
+
20
+ Run from the repository root:
21
+
22
+ ```bash
23
+ command -v project-atlas
24
+ project-atlas --help
25
+ test -f knowledge/manifest.json && echo "project-atlas: initialized" || echo "project-atlas: missing manifest"
26
+ ```
27
+
28
+ If the command is missing:
29
+
30
+ ```bash
31
+ npm install -g project-atlas
32
+ ```
33
+
34
+ If the repository is not initialized, ask the user before running:
35
+
36
+ ```bash
37
+ project-atlas init --repo "$PWD" --template generic-service
38
+ ```
39
+
40
+ Use `java-backend` for Java backend repositories:
41
+
42
+ ```bash
43
+ project-atlas init --repo "$PWD" --template java-backend
44
+ ```
45
+
46
+ Use `frontend-app` for frontend repositories:
47
+
48
+ ```bash
49
+ project-atlas init --repo "$PWD" --template frontend-app
50
+ ```
51
+
52
+ ## Read Context Before The Task
53
+
54
+ Use the task title, requirement keywords, or module names mentioned by the user:
55
+
56
+ ```bash
57
+ project-atlas context --repo "$PWD" --query "<task keywords>" --budget 8000 --format json
58
+ ```
59
+
60
+ If the user mentions a specific file, look up knowledge by source file:
61
+
62
+ ```bash
63
+ project-atlas context --repo "$PWD" --source-file "<repo-relative-file>" --format json
64
+ ```
65
+
66
+ If the task depends on project memory metadata, filter by memory metadata:
67
+
68
+ ```bash
69
+ project-atlas context --repo "$PWD" --memory-type decision --topic "<topic>" --scope "<scope>" --format json
70
+ ```
71
+
72
+ When reading JSON output, inspect:
73
+
74
+ - `items[].source_path`
75
+ - `items[].source_type`
76
+ - `items[].metadata`
77
+ - `truncated`
78
+ - `budget_used`
79
+
80
+ If `truncated` is `true`, narrow `--query` or raise `--budget`, then read context again.
81
+
82
+ ## Health Check
83
+
84
+ Before creating a proposal, handing off work, or preparing a release, run:
85
+
86
+ ```bash
87
+ project-atlas check --repo "$PWD" --format json
88
+ ```
89
+
90
+ If the result reports missing sources, stale sources, missing metadata, bad links, or duplicate topics, mention the risk in your answer. Do not treat unhealthy knowledge as fully trusted.
91
+
92
+ ## Create A Knowledge Proposal
93
+
94
+ When the task produces durable project knowledge, prepare `updates.json`:
95
+
96
+ ```json
97
+ {
98
+ "source_files": ["README.md"],
99
+ "updates": [
100
+ {
101
+ "target": "knowledge/project/overview.md",
102
+ "content": "# Project Overview\n\nWrite verified project knowledge here.\n"
103
+ }
104
+ ]
105
+ }
106
+ ```
107
+
108
+ Create the proposal:
109
+
110
+ ```bash
111
+ project-atlas propose --repo "$PWD" --updates-file updates.json --reason "<why this knowledge changed>"
112
+ ```
113
+
114
+ If the target knowledge document already has source metadata and the user explicitly wants to inherit it, run:
115
+
116
+ ```bash
117
+ project-atlas propose --repo "$PWD" --updates-file updates.json --reason "<why this knowledge changed>" --inherit-source-metadata
118
+ ```
119
+
120
+ ## Create A Project Memory Proposal
121
+
122
+ When the task produces a durable decision, experience, or project fact, prepare `memory.json`:
123
+
124
+ ```json
125
+ {
126
+ "schema_version": "1.0",
127
+ "source_files": ["docs/development-log/example.md"],
128
+ "memories": [
129
+ {
130
+ "target": "knowledge/decisions/example.md",
131
+ "memory_type": "decision",
132
+ "topic": "example decision",
133
+ "scope": "backend",
134
+ "confidence": 0.9,
135
+ "summary": "Short stable memory summary.",
136
+ "body": "Detailed memory body with source evidence."
137
+ }
138
+ ]
139
+ }
140
+ ```
141
+
142
+ Create the memory proposal:
143
+
144
+ ```bash
145
+ project-atlas remember --repo "$PWD" --candidate-file memory.json --reason "<why this memory matters>"
146
+ ```
147
+
148
+ Allowed memory types:
149
+
150
+ - `decision`
151
+ - `experience`
152
+ - `project_fact`
153
+
154
+ ## Review Summary
155
+
156
+ After creating a proposal, read the review summary:
157
+
158
+ ```bash
159
+ project-atlas review-summary --repo "$PWD"
160
+ ```
161
+
162
+ Report:
163
+
164
+ - proposal id
165
+ - target files
166
+ - source files
167
+ - dry-run summary
168
+ - review decision
169
+ - apply safety
170
+ - whether human terminal apply is required
171
+
172
+ ## MCP Tools
173
+
174
+ When connected through `project-atlas-mcp`, use only these tools:
175
+
176
+ - `project_atlas_scan`
177
+ - `project_atlas_context`
178
+ - `project_atlas_stale`
179
+ - `project_atlas_propose`
180
+ - `project_atlas_remember`
181
+ - `project_atlas_check`
182
+ - `project_atlas_review_summary`
183
+
184
+ There is no apply tool. If an MCP tool creates a proposal, tell the user to review it and apply it manually in a terminal.
185
+
186
+ ## MCP Client Config
187
+
188
+ Claude Code:
189
+
190
+ ```bash
191
+ claude mcp add --transport stdio project-atlas -- project-atlas-mcp
192
+ ```
193
+
194
+ Cursor project config `.cursor/mcp.json`:
195
+
196
+ ```json
197
+ {
198
+ "mcpServers": {
199
+ "project-atlas": {
200
+ "type": "stdio",
201
+ "command": "project-atlas-mcp",
202
+ "args": []
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ Continue config:
209
+
210
+ ```yaml
211
+ mcpServers:
212
+ - name: project-atlas
213
+ command: project-atlas-mcp
214
+ args: []
215
+ ```
216
+
217
+ ## AGENTS.md Snippet
218
+
219
+ ```md
220
+ Before changing code, run Project Atlas context for the current task:
221
+
222
+ project-atlas context --repo "$PWD" --query "<task keywords>" --budget 8000 --format json
223
+
224
+ If a file is mentioned, also run:
225
+
226
+ project-atlas context --repo "$PWD" --source-file "<repo-relative-file>" --format json
227
+
228
+ Use Project Atlas outputs as governed project knowledge. You may run check, scan, stale, propose, remember, and review-summary. Do not run project-atlas apply. If knowledge should be updated, create a proposal and tell the user to review and apply it manually in a terminal.
229
+ ```
230
+
231
+ ## Agent Response Template
232
+
233
+ ```text
234
+ Project Atlas:
235
+ - commands run:
236
+ - knowledge files used:
237
+ - stale or health issues:
238
+ - proposal id, if created:
239
+ - apply status: human terminal apply required or not needed
240
+
241
+ Task answer:
242
+ - ...
243
+ ```
@@ -0,0 +1,87 @@
1
+ # Project Atlas 最佳实践
2
+
3
+ Project Atlas 适合沉淀稳定、可验证、会被多次复用的项目知识。它不适合自动生成整仓长文档。
4
+
5
+ ## 写什么
6
+
7
+ - 项目定位和模块边界。
8
+ - 业务术语和页面、接口、任务的真实含义。
9
+ - 稳定流程,比如订单、支付、审核、同步。
10
+ - 对外契约,比如 API、MQ、文件、配置。
11
+ - 风险点,比如敏感配置、人工操作、迁移约束。
12
+ - 已经确认的技术或业务决策。
13
+ - 可复用项目记忆,比如稳定事实、已做决策和踩坑经验。
14
+
15
+ ## 不写什么
16
+
17
+ - 临时调试过程。
18
+ - 未验证的猜测。
19
+ - 大段源码复制。
20
+ - 过期设计稿。
21
+ - 密钥、token、密码和真实敏感配置值。
22
+
23
+ ## 来源文件
24
+
25
+ 每篇知识文档都应该能追溯到来源文件。建议优先引用:
26
+
27
+ - README 和需求文档。
28
+ - OpenSpec 规格。
29
+ - 关键源码入口。
30
+ - 配置样例。
31
+ - 已确认的开发日志。
32
+
33
+ `source_files` 和 `source_hashes` 可以让 stale 检测发现知识是否过期。
34
+
35
+ ## 项目记忆
36
+
37
+ 项目记忆适合写三类内容:
38
+
39
+ - `decision` 记录已经确认的决策,适合后续任务直接遵守。
40
+ - `experience` 记录完成过的工作经验,适合避免重复试错。
41
+ - `project_fact` 记录稳定项目事实,适合新任务快速理解背景。
42
+
43
+ 记忆内容必须有来源。来源可以是 README、开发日志、OpenSpec、关键代码入口或 review 结论。不要把个人偏好、未验证猜测和聊天原文写成项目记忆。
44
+
45
+ 建议把记忆目标放在合适目录:
46
+
47
+ - 决策放 `knowledge/decisions/`。
48
+ - 业务事实放 `knowledge/domains/` 或 `knowledge/project/`。
49
+ - 经验放最接近的业务或质量目录。
50
+
51
+ 生成记忆 proposal:
52
+
53
+ ```bash
54
+ project-atlas remember --repo /path/to/repo --candidate-file memory.json --reason "capture stable project memory"
55
+ ```
56
+
57
+ 默认不会覆盖已有目标文件。确实要替换时,显式加 `--replace-existing`,并在 review 中说明原因。
58
+
59
+ ## 更新节奏
60
+
61
+ - 小改动只在需要时更新相关知识。
62
+ - 跨模块需求完成后,运行 `scan` 和 `stale`。
63
+ - 由 agent 生成 proposal,由人 review 后再 apply。
64
+ - 每次发布前确认 `review-summary` 没有敏感阻断。
65
+ - 发布前或交接前运行 `project-atlas check`,确认知识库健康。
66
+
67
+ ## Agent 使用建议
68
+
69
+ Agent 开始任务前先读:
70
+
71
+ ```bash
72
+ project-atlas context --repo /path/to/repo --query "<task topic>"
73
+ ```
74
+
75
+ 任务结束后,如果稳定知识发生变化,再生成 proposal:
76
+
77
+ ```bash
78
+ project-atlas propose --repo /path/to/repo --updates-file updates.json --reason "refresh project knowledge"
79
+ ```
80
+
81
+ 如果任务沉淀的是项目记忆,使用:
82
+
83
+ ```bash
84
+ project-atlas remember --repo /path/to/repo --candidate-file memory.json --reason "capture task memory"
85
+ ```
86
+
87
+ Project Atlas 的重点是让团队少重复解释项目背景,同时保留人工把关。
@@ -0,0 +1,49 @@
1
+ # Project Atlas Documentation
2
+
3
+ Project Atlas is a Git-first project knowledge base CLI for engineering teams and AI coding agents.
4
+
5
+ The npm package is `project-atlas`. The CLI command is `project-atlas`. The local stdio MCP server is `project-atlas-mcp`.
6
+
7
+ ## Start Here
8
+
9
+ If you are an AI agent, read [Agent Quickstart](agent-quickstart.md) first. It is written as an execution protocol, not as a long tutorial.
10
+
11
+ If you are setting up the tool manually, read [Quick Start](quick-start.md).
12
+
13
+ Chinese documentation is available at [../README.md](../README.md).
14
+
15
+ ## Core Boundary
16
+
17
+ Project Atlas stores shared project knowledge under `knowledge/` and local proposal evidence under `.project-atlas/proposals/`.
18
+
19
+ Agents may read context and create proposals. Agents must not apply proposals. Real writes still require a human terminal confirmation through:
20
+
21
+ ```bash
22
+ project-atlas apply --repo /path/to/repo --proposal-id <id> --confirm
23
+ ```
24
+
25
+ ## Common Commands
26
+
27
+ ```bash
28
+ project-atlas init --repo /path/to/repo --template generic-service
29
+ project-atlas context --repo /path/to/repo --query "order payment" --budget 8000 --format json
30
+ project-atlas check --repo /path/to/repo --format json
31
+ project-atlas propose --repo /path/to/repo --updates-file updates.json --reason "refresh knowledge"
32
+ project-atlas remember --repo /path/to/repo --candidate-file memory.json --reason "capture project memory"
33
+ project-atlas review-summary --repo /path/to/repo
34
+ project-atlas-mcp --help
35
+ ```
36
+
37
+ ## MCP Tools
38
+
39
+ The MCP server exposes only safe tools:
40
+
41
+ - `project_atlas_scan`
42
+ - `project_atlas_context`
43
+ - `project_atlas_stale`
44
+ - `project_atlas_propose`
45
+ - `project_atlas_remember`
46
+ - `project_atlas_check`
47
+ - `project_atlas_review_summary`
48
+
49
+ No MCP apply tool exists.
@@ -0,0 +1,191 @@
1
+ # Agent Quickstart
2
+
3
+ This document is for AI coding agents. The goal is to read governed project knowledge in the first 60 seconds of a task, check whether the knowledge base is healthy, and create reviewable proposals when knowledge should change.
4
+
5
+ ## Rules
6
+
7
+ - Read Project Atlas before broad source exploration.
8
+ - Default to read-only commands.
9
+ - You may run `context`, `check`, `scan`, `stale`, and `review-summary`.
10
+ - You may run `propose` and `remember` to create proposals.
11
+ - Do not run `project-atlas apply`.
12
+ - Do not configure `project-atlas apply` as an MCP tool, agent tool, or automatic script.
13
+ - If `knowledge/manifest.json` is missing, do not silently initialize the repo. Tell the user and provide the init command.
14
+ - When answering, list the knowledge files used, commands run, and any issue that still needs human review.
15
+
16
+ ## First Probe
17
+
18
+ Run from the repository root:
19
+
20
+ ```bash
21
+ command -v project-atlas
22
+ project-atlas --help
23
+ test -f knowledge/manifest.json && echo "project-atlas: initialized" || echo "project-atlas: missing manifest"
24
+ ```
25
+
26
+ If the command is missing:
27
+
28
+ ```bash
29
+ npm install -g project-atlas
30
+ ```
31
+
32
+ If the repo is not initialized, ask the user before running:
33
+
34
+ ```bash
35
+ project-atlas init --repo "$PWD" --template generic-service
36
+ ```
37
+
38
+ Use `java-backend` for Java backend repos and `frontend-app` for frontend repos.
39
+
40
+ ## Read Context
41
+
42
+ Use task keywords:
43
+
44
+ ```bash
45
+ project-atlas context --repo "$PWD" --query "<task keywords>" --budget 8000 --format json
46
+ ```
47
+
48
+ If a file is mentioned:
49
+
50
+ ```bash
51
+ project-atlas context --repo "$PWD" --source-file "<repo-relative-file>" --format json
52
+ ```
53
+
54
+ If project memory metadata matters:
55
+
56
+ ```bash
57
+ project-atlas context --repo "$PWD" --memory-type decision --topic "<topic>" --scope "<scope>" --format json
58
+ ```
59
+
60
+ Check `items[].source_path`, `items[].source_type`, `items[].metadata`, `truncated`, and `budget_used`.
61
+
62
+ ## Health Check
63
+
64
+ Before proposing knowledge changes or handing off work:
65
+
66
+ ```bash
67
+ project-atlas check --repo "$PWD" --format json
68
+ ```
69
+
70
+ Report missing sources, stale sources, missing metadata, bad links, and duplicate topics. Do not treat unhealthy knowledge as fully trusted.
71
+
72
+ ## Create A Knowledge Proposal
73
+
74
+ Prepare `updates.json`:
75
+
76
+ ```json
77
+ {
78
+ "source_files": ["README.md"],
79
+ "updates": [
80
+ {
81
+ "target": "knowledge/project/overview.md",
82
+ "content": "# Project Overview\n\nWrite verified project knowledge here.\n"
83
+ }
84
+ ]
85
+ }
86
+ ```
87
+
88
+ Create the proposal:
89
+
90
+ ```bash
91
+ project-atlas propose --repo "$PWD" --updates-file updates.json --reason "<why this knowledge changed>"
92
+ ```
93
+
94
+ ## Create A Project Memory Proposal
95
+
96
+ Prepare `memory.json`:
97
+
98
+ ```json
99
+ {
100
+ "schema_version": "1.0",
101
+ "source_files": ["docs/development-log/example.md"],
102
+ "memories": [
103
+ {
104
+ "target": "knowledge/decisions/example.md",
105
+ "memory_type": "decision",
106
+ "topic": "example decision",
107
+ "scope": "backend",
108
+ "confidence": 0.9,
109
+ "summary": "Short stable memory summary.",
110
+ "body": "Detailed memory body with source evidence."
111
+ }
112
+ ]
113
+ }
114
+ ```
115
+
116
+ Run:
117
+
118
+ ```bash
119
+ project-atlas remember --repo "$PWD" --candidate-file memory.json --reason "<why this memory matters>"
120
+ ```
121
+
122
+ Allowed memory types are `decision`, `experience`, and `project_fact`.
123
+
124
+ ## Review Summary
125
+
126
+ After creating a proposal:
127
+
128
+ ```bash
129
+ project-atlas review-summary --repo "$PWD"
130
+ ```
131
+
132
+ Report the proposal id, target files, source files, dry-run summary, review decision, apply safety, and whether human apply is needed.
133
+
134
+ ## MCP
135
+
136
+ Use only these MCP tools:
137
+
138
+ - `project_atlas_scan`
139
+ - `project_atlas_context`
140
+ - `project_atlas_stale`
141
+ - `project_atlas_propose`
142
+ - `project_atlas_remember`
143
+ - `project_atlas_check`
144
+ - `project_atlas_review_summary`
145
+
146
+ There is no apply tool.
147
+
148
+ ## MCP Client Config
149
+
150
+ Claude Code:
151
+
152
+ ```bash
153
+ claude mcp add --transport stdio project-atlas -- project-atlas-mcp
154
+ ```
155
+
156
+ Cursor project config `.cursor/mcp.json`:
157
+
158
+ ```json
159
+ {
160
+ "mcpServers": {
161
+ "project-atlas": {
162
+ "type": "stdio",
163
+ "command": "project-atlas-mcp",
164
+ "args": []
165
+ }
166
+ }
167
+ }
168
+ ```
169
+
170
+ Continue config:
171
+
172
+ ```yaml
173
+ mcpServers:
174
+ - name: project-atlas
175
+ command: project-atlas-mcp
176
+ args: []
177
+ ```
178
+
179
+ ## Agent Response Template
180
+
181
+ ```text
182
+ Project Atlas:
183
+ - commands run:
184
+ - knowledge files used:
185
+ - stale or health issues:
186
+ - proposal id, if created:
187
+ - apply status: human terminal apply required or not needed
188
+
189
+ Task answer:
190
+ - ...
191
+ ```
@@ -0,0 +1,79 @@
1
+ # Quick Start
2
+
3
+ This page is the shortest manual path for trying Project Atlas.
4
+
5
+ ## Install Or Build
6
+
7
+ From this repository:
8
+
9
+ ```bash
10
+ npm install
11
+ npm run build
12
+ ```
13
+
14
+ After npm publish, users can install:
15
+
16
+ ```bash
17
+ npm install -g project-atlas
18
+ project-atlas --help
19
+ ```
20
+
21
+ ## Initialize A Repository
22
+
23
+ ```bash
24
+ project-atlas init --repo /path/to/repo --template generic-service
25
+ ```
26
+
27
+ Available templates:
28
+
29
+ - `generic-service`
30
+ - `java-backend`
31
+ - `frontend-app`
32
+
33
+ ## Read Context
34
+
35
+ ```bash
36
+ project-atlas context --repo /path/to/repo --query "order payment" --budget 8000 --format json
37
+ ```
38
+
39
+ Lookup knowledge by source file:
40
+
41
+ ```bash
42
+ project-atlas context --repo /path/to/repo --source-file README.md --format json
43
+ ```
44
+
45
+ ## Create A Proposal
46
+
47
+ Prepare `updates.json`:
48
+
49
+ ```json
50
+ {
51
+ "source_files": ["README.md"],
52
+ "updates": [
53
+ {
54
+ "target": "knowledge/project/overview.md",
55
+ "content": "# Project Overview\n\nWrite verified project knowledge here.\n"
56
+ }
57
+ ]
58
+ }
59
+ ```
60
+
61
+ Run:
62
+
63
+ ```bash
64
+ project-atlas propose --repo /path/to/repo --updates-file updates.json --reason "refresh overview"
65
+ ```
66
+
67
+ ## Review And Apply
68
+
69
+ ```bash
70
+ project-atlas review-summary --repo /path/to/repo
71
+ ```
72
+
73
+ Only a human should apply:
74
+
75
+ ```bash
76
+ project-atlas apply --repo /path/to/repo --proposal-id <id> --confirm
77
+ ```
78
+
79
+ Agents must not run apply.