@handsupmin/gc-tree 0.1.3 → 0.2.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.
package/README.zh.md CHANGED
@@ -1,165 +1,249 @@
1
1
  # gc-tree
2
2
 
3
- 面向 AI 编码工具的分支化全局上下文层。
3
+ <div align="center">
4
+
5
+ <img src="./logo.png" alt="gc-tree logo" width="260" />
6
+
7
+ ### 不止于项目内部的全局上下文。
8
+
9
+ 在你现有的 AI 工具之上,再加一层可复用、能长期积累的上下文。
10
+ 像管理 Git 分支一样管理多条上下文线索。
11
+
12
+ [![npm version](https://img.shields.io/npm/v/%40handsupmin%2Fgc-tree)](https://www.npmjs.com/package/@handsupmin/gc-tree)
13
+ [![npm downloads](https://img.shields.io/npm/dm/%40handsupmin%2Fgc-tree)](https://www.npmjs.com/package/@handsupmin/gc-tree)
14
+ [![GitHub stars](https://img.shields.io/github/stars/handsupmin/gc-tree)](https://github.com/handsupmin/gc-tree/stargazers)
15
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/handsupmin/gc-tree/blob/main/LICENSE)
16
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](https://nodejs.org)
4
17
 
5
18
  [English](https://github.com/handsupmin/gc-tree/blob/main/README.md) | [한국어](https://github.com/handsupmin/gc-tree/blob/main/README.ko.md) | [简体中文](https://github.com/handsupmin/gc-tree/blob/main/README.zh.md) | [日本語](https://github.com/handsupmin/gc-tree/blob/main/README.ja.md) | [Español](https://github.com/handsupmin/gc-tree/blob/main/README.es.md)
6
19
 
7
- ## 介绍
20
+ </div>
8
21
 
9
- `gctree` 是一个面向 AI 编码工具的轻量级 **Global Context Tree**。
10
- 它为长期上下文提供了一个可复用、基于文件、支持分支的明确归宿,而且可以自然接入现有工作流。
22
+ ---
11
23
 
12
- 当单个 `AGENTS.md`、`CLAUDE.md` 或一段提示词已经不够时,`gctree` 可以帮助你:
24
+ ## 问题所在
13
25
 
14
- - 按产品、客户或工作流隔离上下文
15
- - 用 markdown 文档保存 source of truth,而不是依赖隐藏记忆
16
- - 通过精简索引和 summary-first 文档更快定位当前上下文
17
- - 通过偏好的 LLM CLI 完成 onboarding 与长期更新
18
- - 让某个 gc-branch 只作用于真正相关的仓库
26
+ 你每天都在用 Claude Code 或 Codex。但你的实际工作横跨多个仓库、产品和客户——而 AI 工具只认识当前文件。
19
27
 
20
- ## 简要特性
28
+ 于是你不得不一遍遍地做这些事:
21
29
 
22
- - **Provider 驱动的 onboarding**
23
- `gctree init` 会先询问你想使用哪种 provider 模式(`claude-code`、`codex` 或 `both`),再询问响应语言,并保存这些选择,然后给当前环境安装对应的命令表面,并为默认 `main` gc-branch 启动引导式 onboarding。
24
- - **带仓库范围的 gc-branch**
25
- 你可以通过 `~/.gctree/branch-repo-map.json` 把某个 gc-branch 绑定到指定仓库集合,比如让 A 只作用于 B/C/D,而在 F 中忽略。
26
- - **交互式范围保护**
27
- 如果 `gctree resolve` 发现当前仓库还没有映射到这个 gc-branch,它可以询问是仅本次继续、以后总是使用,还是在这个仓库里忽略它。
28
- - **Summary-first 文档结构**
29
- 工具可以先读取简短摘要,只有在需要时才展开完整文档。
30
- - **引导式长期更新**
31
- 不需要手写 JSON 文件,也可以通过同样的 provider 流程更新全局上下文。
30
+ - 重新解释哪些仓库属于同一套系统
31
+ - 把同一份架构文档反复粘贴进提示词
32
+ - 提醒 AI 它上周"已经知道"的编码规范
33
+ - 手动剔除与当前仓库无关的上下文
32
34
 
33
- ## 安装与快速开始
35
+ 这不是 AI 的问题,而是**上下文管理的问题**。
34
36
 
35
- ### 通过 npm 安装
37
+ ---
36
38
 
37
- ```bash
38
- npm install -g @handsupmin/gc-tree
39
- ```
39
+ ## gc-tree 做什么
40
40
 
41
- 如果你只想临时运行一次,也可以:
41
+ `gc-tree` 工作在**仓库之上**。它把上下文存储为结构化的 Markdown 文件,让 AI 工具在每次会话前自动拉取相关内容。
42
42
 
43
43
  ```bash
44
- npx @handsupmin/gc-tree init
44
+ gctree resolve --query "auth token rotation policy"
45
45
  ```
46
46
 
47
- - **包名:** `@handsupmin/gc-tree`
48
- - **CLI 命令:** `gctree`
49
- - **要求:** Node.js 20+
50
- 如果要从源码开发,请查看 [docs/local-development.md](https://github.com/handsupmin/gc-tree/blob/main/docs/local-development.md)。
47
+ ```json
48
+ {
49
+ "gc_branch": "main",
50
+ "matches": [
51
+ {
52
+ "title": "认证与 Session 规范",
53
+ "score": 4,
54
+ "summary": "每次请求都做 JWT rotation,refresh token 存在 httpOnly cookie 里,access token TTL 15 分钟",
55
+ "excerpt": "## 认证流程\nAccess token:15 分钟 TTL,每次认证请求都做 rotation..."
56
+ }
57
+ ]
58
+ }
59
+ ```
51
60
 
52
- ### 快速开始
61
+ AI 工具拿到的是正确的上下文——不是整个知识库,而是恰好相关的那一片。
53
62
 
54
- #### 1) 初始化 gc-tree
63
+ **实测:每次查询只注入约 4% 的总上下文。** 其余 96% 留在磁盘上,真正需要时才进入 token 窗口。
55
64
 
56
- ```bash
57
- gctree init
58
- ```
65
+ ---
59
66
 
60
- 这个命令会:
67
+ ## 适合哪些人
61
68
 
62
- - 创建 `~/.gctree`
63
- - 创建默认 `main` gc-branch
64
- - 让你选择 provider 模式(`claude-code`、`codex` 或 `both`)
65
- - 如果你选择 `both`,再选择这次 onboarding 要由哪个 provider 启动
66
- - 让你选择语言(`English`、`Korean`,或手动输入语言)
67
- - 把 provider 模式、实际 onboarding provider 和语言保存到 `~/.gctree/settings.json`
68
- - 为当前环境安装对应的命令表面
69
- - 当 `main` 仍为空时,为当前 gc-branch 启动引导式 onboarding
69
+ 如果以下几条符合你的情况,gc-tree 会很适合你:
70
70
 
71
- #### 2) 解析当前上下文
71
+ - 工作横跨**多个仓库**(单体仓库团队、平台 + 客户仓库、后端 + 前端技术栈)
72
+ - 同一周内要在**多个产品或客户**之间来回切换
73
+ - 每次开 AI 会话都要**重复解释相同的上下文**
74
+ - 希望 AI 工具不只了解当前文件,还能理解**编码规范、架构和领域知识**
75
+
76
+ 如果你只在一个仓库、一个产品里工作,不需要这个工具。`CLAUDE.md` 或 `.cursorrules` 就够了。
77
+
78
+ ---
79
+
80
+ ## 和 CLAUDE.md 或 cursor rules 有什么区别?
81
+
82
+ `CLAUDE.md` 很好用——在单个仓库里。
83
+
84
+ 一旦你有了多个仓库、客户或工作线:
85
+
86
+ | | `CLAUDE.md` / cursor rules | `gc-tree` |
87
+ |---|---|---|
88
+ | 作用范围 | 单个仓库 | 多个仓库,一套上下文 |
89
+ | 持久化方式 | 仓库内的文件 | 存储在仓库外,跨会话复用 |
90
+ | 切换上下文 | 手动编辑文件 | `gctree checkout client-b` |
91
+ | 相关性过滤 | 全部或全无 | 只注入匹配的文档(约 4%) |
92
+ | 初始化方式 | 手写 | 由 AI 工具引导完成 |
93
+ | 支持 Codex | ✅ | ✅ |
94
+ | 支持 Claude Code | ✅ | ✅ |
95
+
96
+ ---
97
+
98
+ ## 经过验证的性能
99
+
100
+ 基于真实内部文档测试(4 份 Notion 导出,中英文混合查询):
101
+
102
+ | 指标 | 结果 |
103
+ |---|---|
104
+ | Recall——相关查询找到正确文档的比例 | **100%**(16/16) |
105
+ | Precision——无关查询返回空结果的比例 | **80%**(4/5) |
106
+ | F1 分数 | **88.9%** |
107
+ | 每次查询注入的 token 占总上下文的比例 | **约 4%** |
108
+ | 支持中英文混合查询 | ✅ |
109
+
110
+ ---
111
+
112
+ ## Claude Code 和 Codex 均已验证可用
72
113
 
73
114
  ```bash
74
- gctree resolve --query "auth token rotation"
115
+ gctree scaffold --host claude-code # 安装 CLAUDE.md 片段 + /gc-onboard、/gc-update-global-context
116
+ gctree scaffold --host codex # 安装 AGENTS.md 片段 + $gc-onboard、$gc-update-global-context
117
+ gctree scaffold --host both # 两者同时安装
75
118
  ```
76
119
 
77
- 如果当前仓库不在这个 gc-branch 的映射范围内,`gctree` 可以让你选择:
120
+ 两个 provider 使用同一个底层上下文存储。onboard 一次,两个工具都能用。
121
+
122
+ **Claude Code** — 使用 `/gc-resolve-context`、`/gc-onboard`、`/gc-update-global-context` 斜杠命令。
78
123
 
79
- 1. 这次先继续
80
- 2. 以后这个仓库总是使用这个 gc-branch
81
- 3. 在这个仓库里忽略这个 gc-branch
124
+ **Codex** — 使用 `$gc-resolve-context`、`$gc-onboard`、`$gc-update-global-context` skill。已通过 `codex exec` 实际验证:
82
125
 
83
- 如果选择 2 或 3,`~/.gctree/branch-repo-map.json` 会被更新。
126
+ ```
127
+ gctree status → gc_branch: main,doc_count: 2
128
+ gctree resolve --query 'NestJS DTO plainToInstance'
129
+ → 匹配到"后端编码规范"(score: 3)
130
+ → DTO:class-transformer plainToInstance,class-validator 必填
131
+ → 错误处理:基于 HttpException 的自定义异常,禁止直接抛出 raw Error
132
+ ```
84
133
 
85
- #### 3) 需要独立上下文时创建新的 gc-branch
134
+ ---
135
+
136
+ ## 安装与快速开始
86
137
 
87
138
  ```bash
88
- gctree checkout -b client-b
139
+ npm install -g @handsupmin/gc-tree
140
+ gctree init
89
141
  ```
90
142
 
91
- `checkout -b` 会创建一个**新的空 gc-branch**,不会复制已有分支里的文档。
143
+ `gctree init` 会引导你:
144
+ 1. 选择 provider:`claude-code`、`codex` 或 `both`
145
+ 2. 在当前仓库安装集成文件
146
+ 3. 为 `main` gc-branch 完成引导式 onboarding
92
147
 
93
- #### 4) 为一个空的 gc-branch 执行 onboarding
148
+ 之后,AI 工具会自动学会在规划或实现前调用 `gctree resolve`。
149
+
150
+ - **CLI:** `gctree`
151
+ - **要求:** Node.js 20+
152
+
153
+ ---
154
+
155
+ ## 常用操作
156
+
157
+ ### 为不同工作线创建独立上下文
94
158
 
95
159
  ```bash
160
+ gctree checkout -b client-b
96
161
  gctree onboard
97
162
  ```
98
163
 
99
- #### 5) 后续执行长期上下文更新
164
+ 每个 gc-branch 都是完全独立的上下文通道,像 Git 分支一样自由切换。
165
+
166
+ ### 按需拉取相关上下文
100
167
 
101
168
  ```bash
102
- gctree update-global-context
169
+ gctree resolve --query "billing retry policy"
103
170
  ```
104
171
 
105
- 简短别名:
172
+ 只返回匹配的文档——标题、摘要和摘录。摘要不够用时,工具才会读完整文档。
173
+
174
+ ### 保持上下文与时俱进
106
175
 
107
176
  ```bash
108
- gctree update-gc
109
- gctree ugc
177
+ gctree update-global-context # 或:gctree update-gc / gctree ugc
110
178
  ```
111
179
 
112
- 如果实际工作后发现某个仓库确实属于当前 gc-branch,更自然的流程是:
180
+ 引导式更新流程——AI 工具询问发生了哪些变化,并将新上下文写回 gc-branch
113
181
 
114
- 1. 先把这个仓库加入 branch repo map
115
- 2. 再用 `gctree update-global-context` 补充这个仓库是什么、为什么重要等长期上下文
116
-
117
- #### 6) 重新 onboarding 前先重置 gc-branch
182
+ ### 限定上下文作用的仓库范围
118
183
 
119
184
  ```bash
120
- gctree reset-gc-branch --branch client-b --yes
185
+ gctree set-repo-scope --branch client-b --include # 包含当前仓库
186
+ gctree set-repo-scope --branch client-b --exclude # 排除当前仓库
121
187
  ```
122
188
 
123
- ### 运行时可见的 provider 命令
189
+ `gc-tree` 不会向不相关的仓库注入上下文。
190
+
191
+ ---
124
192
 
125
- scaffold 之后,在运行时可见的命令是:
193
+ ## 上下文的存储结构
194
+
195
+ ```
196
+ ~/.gctree/
197
+ branches/
198
+ main/
199
+ index.md ← 压缩索引,≤2000 字符,优先加载
200
+ docs/
201
+ auth.md ← 完整文档,按需读取
202
+ architecture.md
203
+ client-b/
204
+ index.md
205
+ docs/
206
+ ...
207
+ branch-repo-map.json ← 哪些仓库属于哪个 gc-branch
208
+ settings.json ← 首选 provider、语言
209
+ ```
126
210
 
127
- - **Codex:** `$gc-onboard`, `$gc-update-global-context`
128
- - **Claude Code:** `/gc-onboard`, `/gc-update-global-context`
211
+ 上下文存储在仓库之外——无需 `.gitignore` 规则,不会误提交,使用同一 gc-branch 的所有项目都可复用。
129
212
 
130
- 这些命令在开始收集或更新长期上下文之前,都应该先明确说明当前激活的是哪个 gc-branch,并且除非用户明确要求切换,否则要始终使用保存下来的语言。
213
+ ---
131
214
 
132
- ### 核心命令速览
215
+ ## 核心命令
133
216
 
134
217
  | 目标 | 命令 |
135
- | --- | --- |
218
+ |---|---|
136
219
  | 初始化 gc-tree 并选择 provider | `gctree init` |
137
- | 确认当前 gc-branch | `gctree status` |
220
+ | 确认当前激活的 gc-branch | `gctree status` |
138
221
  | 搜索当前上下文 | `gctree resolve --query "..."` |
139
- | 查看仓库范围规则 | `gctree repo-map` |
140
- | 为 gc-branch 显式设置仓库包含/排除 | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
141
222
  | 创建或切换 gc-branch | `gctree checkout <branch>` / `gctree checkout -b <branch>` |
142
- | 为一个空的 gc-branch 执行 onboarding | `gctree onboard` |
143
- | 为当前 gc-branch 执行长期更新 | `gctree update-global-context` / `gctree update-gc` / `gctree ugc` |
223
+ | 列出所有 gc-branch | `gctree branches` |
224
+ | 对空 gc-branch 进行引导式 onboarding | `gctree onboard` |
225
+ | 对当前 gc-branch 进行引导式更新 | `gctree update-global-context` / `gctree ugc` |
226
+ | 查看仓库范围规则 | `gctree repo-map` |
227
+ | 为 gc-branch 包含或排除当前仓库 | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
144
228
  | 重新 onboarding 前重置 gc-branch | `gctree reset-gc-branch --branch <name> --yes` |
145
- | 手动为其他环境安装 scaffold | `gctree scaffold --host codex --target /path/to/repo` |
229
+ | 在新环境中安装 scaffold | `gctree scaffold --host codex --target /path/to/repo` |
146
230
 
147
- ## 文档
231
+ ---
148
232
 
149
- 详细文档位于 [`docs/`](https://github.com/handsupmin/gc-tree/tree/main/docs) 目录下。
233
+ ## 文档
150
234
 
151
235
  - **概念** — [`docs/concept.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/concept.zh.md)
152
- 说明 `gctree` 是什么、解决什么问题,以及全局上下文层的边界。
153
236
  - **原理** — [`docs/principles.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/principles.zh.md)
154
- 介绍 gc-branch、仓库范围、summary-first 文档和引导式更新等原则。
155
237
  - **使用方法** — [`docs/usage.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/usage.zh.md)
156
- 介绍标准 CLI 流程、provider 命令、仓库范围行为和集成方式。
157
- - **本地运行方法** — [`docs/local-development.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/local-development.zh.md)
158
- 说明依赖安装、本地运行 CLI 与提交前验证方式。
238
+ - **本地开发** [`docs/local-development.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/local-development.zh.md)
239
+
240
+ ---
159
241
 
160
242
  ## 贡献
161
243
 
162
- 欢迎贡献。开发流程与 PR 检查清单位于英文文档 [CONTRIBUTING.md](https://github.com/handsupmin/gc-tree/blob/main/CONTRIBUTING.md)。
244
+ 欢迎贡献。开发流程与 PR 检查清单见 [CONTRIBUTING.md](https://github.com/handsupmin/gc-tree/blob/main/CONTRIBUTING.md)。
245
+
246
+ ---
163
247
 
164
248
  ## 许可证
165
249
 
@@ -2,13 +2,44 @@ import { readFile } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { extractExcerpt, extractSummary, parseIndexEntries } from './markdown.js';
4
4
  import { branchDir, branchIndexPath } from './paths.js';
5
- function scoreText(text, query) {
6
- const tokens = String(query || '')
5
+ // Common English stop words that are too short or generic to be meaningful query signals.
6
+ const STOP_WORDS = new Set([
7
+ 'a', 'an', 'the', 'and', 'or', 'but', 'if', 'in', 'on', 'at', 'to', 'for',
8
+ 'of', 'with', 'by', 'as', 'is', 'it', 'its', 'be', 'was', 'are', 'were',
9
+ 'do', 'did', 'has', 'had', 'not', 'no', 'so', 'up', 'out', 'off', 'via',
10
+ 'vs', 'per', 'set', 'get', 'run', 'add', 'use', 'new', 'old', 'all', 'any',
11
+ ]);
12
+ function tokenize(text) {
13
+ // Split on whitespace, punctuation, and symbols — preserving Unicode letters
14
+ // and digits (including Korean, Japanese, CJK, etc.).
15
+ return String(text || '')
7
16
  .toLowerCase()
8
- .split(/[^a-z0-9]+/)
9
- .filter((token) => token.length >= 2);
17
+ .split(/[^\p{L}\p{N}]+/u)
18
+ .filter((t) => t.length >= 2 && !STOP_WORDS.has(t));
19
+ }
20
+ function makeTokenRegex(token) {
21
+ // ASCII-only token: use \b word boundary (prevents "store" → "storefront").
22
+ // Non-ASCII token (Korean, CJK, etc.): use Unicode letter lookbehind/lookahead
23
+ // because \b doesn't work for non-ASCII characters.
24
+ const isAscii = /^[a-z0-9]+$/.test(token);
25
+ return isAscii
26
+ ? new RegExp(`\\b${token}\\b`)
27
+ : new RegExp(`(?<!\\p{L})${token}(?!\\p{L})`, 'u');
28
+ }
29
+ function scoreText(text, query) {
30
+ const tokens = tokenize(query);
31
+ if (tokens.length === 0)
32
+ return 0;
10
33
  const haystack = String(text || '').toLowerCase();
11
- return tokens.reduce((sum, token) => sum + (haystack.includes(token) ? 1 : 0), 0);
34
+ return tokens.reduce((sum, token) => {
35
+ try {
36
+ return sum + (makeTokenRegex(token).test(haystack) ? 1 : 0);
37
+ }
38
+ catch {
39
+ // Regex construction failed (e.g. special chars in token) — fall back to substring
40
+ return sum + (haystack.includes(token) ? 1 : 0);
41
+ }
42
+ }, 0);
12
43
  }
13
44
  export async function resolveContext({ home, branch, query, }) {
14
45
  const indexRaw = await readFile(branchIndexPath(home, branch), 'utf8');
@@ -19,7 +50,10 @@ export async function resolveContext({ home, branch, query, }) {
19
50
  const raw = await readFile(fullPath, 'utf8');
20
51
  const summary = extractSummary(raw);
21
52
  const combined = `${entry.title}\n${summary}\n${raw}`;
22
- const score = scoreText(combined, query);
53
+ // Title matches count double (higher signal density)
54
+ const titleScore = scoreText(entry.title, query);
55
+ const bodyScore = scoreText(`${summary}\n${raw}`, query);
56
+ const score = titleScore * 2 + bodyScore;
23
57
  if (score <= 0)
24
58
  continue;
25
59
  matches.push({
@@ -2,51 +2,51 @@
2
2
 
3
3
  [English](concept.md) | [한국어](concept.ko.md) | [简体中文](concept.zh.md) | [日本語](concept.ja.md) | [Español](concept.es.md)
4
4
 
5
- ## Summary
5
+ ## Resumen
6
6
 
7
- `gctree` es una capa de contexto global pequeña y clara para herramientas de programación con IA. Mantiene el contexto duradero en documentos markdown fuera de un único repositorio, permite cambiarlo y consultarlo por gc-branch, y además puede limitar cada gc-branch a los repositorios donde realmente aplica.
7
+ `gctree` es una capa ligera de contexto global para herramientas de programación con IA. Mantiene el contexto duradero en documentos markdown explícitos fuera de cualquier repositorio individual, permite cambiar entre gc-branches y puede limitar cada gc-branch a los repositorios donde realmente tiene sentido.
8
8
 
9
9
  ## Qué es `gctree`
10
10
 
11
- `gctree` es una CLI ligera para gestionar contexto global reutilizable.
12
- Está pensada para personas y equipos que necesitan conservar el mismo contexto duradero entre varios repositorios, sesiones y herramientas.
11
+ `gctree` es una CLI para gestionar contexto global reutilizable.
12
+ Está pensada para equipos y personas que quieren que el contexto de largo recorrido sobreviva entre repositorios, sesiones y herramientas, sin convertirlo en una memoria oculta imposible de inspeccionar.
13
13
 
14
- En lugar de dejar ese conocimiento repartido entre archivos de prompts o depender de memoria oculta, `gctree` le da un lugar claro, estable y basado en archivos.
14
+ En lugar de repartir el conocimiento importante entre archivos de prompt, notas locales al repo e instrucciones improvisadas, `gctree` le da a ese conocimiento un hogar estable, visible y respaldado por archivos.
15
15
 
16
16
  ## Qué problema resuelve
17
17
 
18
- Muchos entornos de programación con IA empiezan con una de estas opciones:
18
+ Muchos entornos de programación con IA empiezan de forma bastante simple:
19
19
 
20
- - un solo `AGENTS.md`
21
- - un solo `CLAUDE.md`
22
- - un archivo de prompts dentro del repositorio
23
- - un conjunto de notas copiadas manualmente en los prompts
20
+ - un `AGENTS.md`
21
+ - un `CLAUDE.md`
22
+ - un archivo de prompt dentro del repo
23
+ - unas pocas notas que se copian al prompt cuando hacen falta
24
24
 
25
- Eso funciona al principio, pero con el tiempo aparecen necesidades como estas:
25
+ Eso funciona durante un tiempo. Pero cuando empiezan a aparecer necesidades reales, la misma configuración empieza a romperse:
26
26
 
27
- - separar el contexto por producto o cliente
28
- - mantener contexto fuera de un único repositorio
29
- - reutilizar la misma documentación duradera desde varias herramientas
30
- - encontrar el contexto correcto de forma rápida y consistente
31
- - actualizar el contexto duradero de una forma más segura
32
- - trabajar en paralelo en muchos repositorios y sesiones a la vez
27
+ - cada producto necesita un contexto distinto
28
+ - el trabajo para clientes debe mantenerse aislado
29
+ - la guía reutilizable debería vivir fuera de un único repositorio
30
+ - varias herramientas deberían poder leer la misma source of truth
31
+ - el contexto duradero debería evolucionar con un flujo seguro y revisable
32
+ - una misma persona puede tener muchas sesiones abiertas en muchos repos a la vez
33
33
 
34
- `gctree` se ocupa precisamente de esa capa.
34
+ `gctree` existe para resolver precisamente esa capa del problema, y hacerlo de forma limpia.
35
35
 
36
36
  ## Límite de alcance
37
37
 
38
- `gctree` intencionalmente no es:
38
+ `gctree` no pretende ser:
39
39
 
40
- - un orquestador de entrega request-to-commit
40
+ - un orquestador integral que lleve una petición hasta el commit
41
41
  - un sistema de memoria oculta
42
42
  - un runtime de colaboración en navegador
43
- - un producto generalista de base de conocimiento
43
+ - un producto de base de conocimiento de propósito general
44
44
 
45
- Se centra en ramas reutilizables de contexto global y en flujos de actualización explícitos.
45
+ Se concentra en una sola tarea: gestionar ramas de contexto global reutilizable y sus actualizaciones explícitas.
46
46
 
47
- ## Estructura de archivos
47
+ ## Modelo de archivos
48
48
 
49
- Un directorio home típico se ve así:
49
+ Un directorio personal típico queda así:
50
50
 
51
51
  ```text
52
52
  ~/.gctree/
@@ -60,22 +60,22 @@ Un directorio home típico se ve así:
60
60
  docs/
61
61
  ```
62
62
 
63
- - `HEAD` indica el gc-branch activo de fallback.
64
- - `settings.json` guarda el modo de provider, el provider real usado para iniciar el onboarding y el idioma preferido del flujo.
65
- - `branch-repo-map.json` guarda las reglas include/exclude por gc-branch.
63
+ - `HEAD` sigue el gc-branch activo por defecto.
64
+ - `settings.json` guarda el modo de provider, el provider elegido para lanzar el onboarding en runtime y el idioma preferido del flujo.
65
+ - `branch-repo-map.json` guarda qué repositorios están incluidos o excluidos para cada gc-branch.
66
66
  - `branch.json` guarda metadatos ligeros del gc-branch.
67
- - `index.md` es el punto de entrada compacto para las herramientas.
68
- - `docs/` guarda los documentos markdown source-of-truth.
67
+ - `index.md` es el punto de entrada compacto para herramientas y personas.
68
+ - `docs/` contiene los documentos markdown que actúan como source of truth.
69
69
 
70
- ## Comportamiento con alcance por repositorio
70
+ ## Comportamiento con conciencia de repositorio
71
71
 
72
- Un gc-branch no tiene por qué aplicarse a todos los repositorios.
73
- Si la rama `A` solo es relevante para `B`, `C` y `D`, eso puede registrarse en `branch-repo-map.json`.
72
+ Un gc-branch no tiene por qué aplicarse en todas partes.
73
+ Si la rama `A` solo es relevante para los repositorios `B`, `C` y `D`, `gctree` puede dejarlo registrado en `branch-repo-map.json`.
74
74
 
75
- Entonces, si ejecutas `gctree resolve` desde `F`, puedes elegir entre:
75
+ Cuando `gctree resolve` se ejecuta desde otro repositorio, por ejemplo `F`, puede:
76
76
 
77
- - continuar solo esta vez
78
- - usar siempre esa rama en ese repo
79
- - ignorarla en ese repo
77
+ - continuar solo una vez
78
+ - usar siempre ese gc-branch en `F`
79
+ - ignorar ese gc-branch en `F`
80
80
 
81
- Eso vuelve a `gctree` mucho más seguro para usuarios intensivos que mantienen muchas sesiones paralelas abiertas sobre repositorios no relacionados.
81
+ Eso hace que gc-tree sea mucho más seguro para quienes mantienen muchas sesiones paralelas abiertas en repositorios que no tienen relación entre sí.
@@ -1,52 +1,52 @@
1
- # コンセプト
1
+ # 概念
2
2
 
3
3
  [English](concept.md) | [한국어](concept.ko.md) | [简体中文](concept.zh.md) | [日本語](concept.ja.md) | [Español](concept.es.md)
4
4
 
5
- ## Summary
5
+ ## 要約
6
6
 
7
- `gctree` は AI コーディングツール向けの、小さく明確なグローバルコンテキストレイヤーです。長期コンテキストを単一リポジトリの外にある markdown 文書として管理し、gc-branch 単位で切り替え・参照・維持でき、さらに実際に関係するリポジトリだけに適用範囲を絞れます。
7
+ `gctree` は AI コーディングツール向けの軽量なグローバルコンテキストレイヤーです。単一リポジトリの外側に長期コンテキストを明示的な markdown 文書として置き、gc-branch を切り替えながら文脈を使い分けられるようにし、各 gc-branch が本当に関係あるリポジトリにだけ影響するよう制御できます。
8
8
 
9
- ## `gctree` とは
9
+ ## `gctree` とは何か
10
10
 
11
- `gctree` は再利用可能なグローバルコンテキストを管理するための軽量 CLI です。
12
- 複数のリポジトリ、セッション、ツールをまたいでも同じ長期コンテキストを使い続けたい個人やチームのために設計されています。
11
+ `gctree` は再利用できるグローバルコンテキストを管理するための CLI です。
12
+ 複数のリポジトリ、複数のセッション、複数のツールをまたいでも長期コンテキストが生き残るようにしつつ、それをブラックボックスな隠れメモリにはしない、という前提で作られています。
13
13
 
14
- 長期知識を隠れたメモリに任せたり、複数のプロンプトファイルへ散らしたりする代わりに、`gctree` はその知識に明確で安定したファイルベースの置き場所を与えます。
14
+ 大事な知識がプロンプトファイル、リポジトリ内メモ、場当たり的な指示に散らばる代わりに、`gctree` はその知識に安定したファイルベースの置き場所を与えます。
15
15
 
16
- ## 解決する課題
16
+ ## 何の問題を解決するのか
17
17
 
18
- 多くの AI コーディング環境は、次のいずれかから始まります。
18
+ 多くの AI コーディング環境は、最初はこんな形で始まります。
19
19
 
20
- - 1 つの `AGENTS.md`
21
- - 1 つの `CLAUDE.md`
22
- - リポジトリ内のローカルなプロンプトファイル
23
- - プロンプトに都度貼り付けるメモ
20
+ - `AGENTS.md` が 1 つ
21
+ - `CLAUDE.md` が 1 つ
22
+ - リポジトリ内の短いプロンプトファイルが 1 つ
23
+ - 必要なときだけプロンプトに貼り付けるメモが少し
24
24
 
25
- 最初はそれで十分でも、やがて次のような要件が出てきます。
25
+ しばらくはそれで回ります。けれど実務が乗ってくると、同じやり方はすぐ苦しくなります。
26
26
 
27
- - プロダクトやクライアントごとにコンテキストを分けたい
28
- - 1 つのリポジトリの外にコンテキストを保ちたい
29
- - 複数ツールが同じ長期文書を再利用できるようにしたい
30
- - 必要なコンテキストを一貫した方法で素早く見つけたい
31
- - 長期コンテキストをより安全に更新したい
32
- - 同じユーザーが複数のリポジトリ・複数のセッションで並行作業する
27
+ - プロダクトごとに必要なコンテキストが違う
28
+ - クライアント案件は互いに分離しておく必要がある
29
+ - 再利用したいガイダンスは単一リポジトリの外に置きたい
30
+ - 複数ツールが同じ source of truth を読めるべき
31
+ - 長期コンテキストは安全でレビュー可能な流れで育てたい
32
+ - 1 人のユーザーが同時に複数リポジトリで複数セッションを動かすことがある
33
33
 
34
- `gctree` は、まさにその層を扱います。
34
+ `gctree` は、まさにそのレイヤーをきれいに扱うためのものです。
35
35
 
36
- ## スコープ境界
36
+ ## スコープの境界
37
37
 
38
- `gctree` が意図的に担当しないものは次の通りです。
38
+ `gctree` は意図的に、次のものではありません。
39
39
 
40
- - request-to-commit 型のデリバリーオーケストレータ
41
- - 隠れたメモリシステム
42
- - ブラウザ協業ランタイム
40
+ - リクエストからコミットまでを一気通貫で回す実行オーケストレータ
41
+ - 隠れメモリの仕組み
42
+ - ブラウザ型のコラボレーションランタイム
43
43
  - 汎用ナレッジベース製品
44
44
 
45
- `gctree` は、再利用可能なグローバルコンテキストブランチと、明示的な更新フローに集中します。
45
+ `gctree` が集中する仕事は 1 つです。再利用できるグローバルコンテキストブランチと、その明示的な更新を管理することです。
46
46
 
47
- ## ファイル構成
47
+ ## ファイルモデル
48
48
 
49
- 典型的なホームディレクトリ構成は次の通りです。
49
+ 典型的なホームディレクトリ配下の構成はこうなります。
50
50
 
51
51
  ```text
52
52
  ~/.gctree/
@@ -60,22 +60,22 @@
60
60
  docs/
61
61
  ```
62
62
 
63
- - `HEAD` fallback のアクティブ gc-branch を指します。
64
- - `settings.json` provider モード、実際のオンボーディング起動 provider、優先ワークフロー言語を保持します。
65
- - `branch-repo-map.json` gc-branch ごとの include/exclude リポジトリ規則を保存します。
66
- - `branch.json` は軽量な gc-branch メタデータを保存します。
67
- - `index.md` はツール向けの小さな入口です。
68
- - `docs/` には source-of-truth の markdown 文書を保存します。
63
+ - `HEAD` はデフォルトでアクティブになる gc-branch を追跡します。
64
+ - `settings.json` には provider モード、ランタイム起動に使うオンボーディング provider、優先するワークフロー言語が入ります。
65
+ - `branch-repo-map.json` には各 gc-branch ごとのリポジトリの include / exclude 情報が入ります。
66
+ - `branch.json` には軽量な gc-branch メタデータが入ります。
67
+ - `index.md` はツールが最初に読むコンパクトな入口です。
68
+ - `docs/` には source-of-truth の markdown 文書が入ります。
69
69
 
70
- ## リポジトリ範囲の振る舞い
70
+ ## リポジトリを意識した振る舞い
71
71
 
72
- ある gc-branch がすべてのリポジトリに適用される必要はありません。
73
- たとえば branch `A` が `B`、`C`、`D` にだけ関係するなら、その事実を `branch-repo-map.json` に記録できます。
72
+ gc-branch はどこでも有効である必要はありません。
73
+ たとえば branch `A` が repo `B`、`C`、`D` にしか関係しないなら、その事実を `branch-repo-map.json` に記録できます。
74
74
 
75
- その状態で `F` リポジトリから `gctree resolve` を実行すると、次を選べます。
75
+ その状態で別の repo `F` から `gctree resolve` を実行した場合、`gctree` は次のように扱えます。
76
76
 
77
- - 今回だけ使う
78
- - 今後もこのリポジトリで使う
79
- - このリポジトリでは無視する
77
+ - 今回だけ続ける
78
+ - 今後も `F` ではその gc-branch を使う
79
+ - `F` ではその gc-branch を無視する
80
80
 
81
- これにより、多数のセッションを開いて複数の無関係なリポジトリで並行作業する heavy ユーザーにも、より安全に使えるようになります。
81
+ これによって、無関係なリポジトリをまたいで多くの並行セッションを開いているヘビーユーザーでも、gc-tree をかなり安全に使えます。