@handsupmin/gc-tree 0.1.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es.md +135 -119
- package/README.ja.md +136 -120
- package/README.ko.md +137 -121
- package/README.md +134 -118
- package/README.zh.md +140 -123
- package/dist/src/resolve.js +40 -6
- package/docs/concept.es.md +45 -33
- package/docs/concept.ja.md +41 -29
- package/docs/concept.ko.md +48 -36
- package/docs/concept.md +13 -1
- package/docs/concept.zh.md +48 -36
- package/docs/local-development.es.md +44 -22
- package/docs/local-development.ja.md +40 -18
- package/docs/local-development.ko.md +47 -25
- package/docs/local-development.md +27 -5
- package/docs/local-development.zh.md +27 -5
- package/docs/principles.es.md +39 -26
- package/docs/principles.ja.md +26 -13
- package/docs/principles.ko.md +40 -27
- package/docs/principles.md +15 -2
- package/docs/principles.zh.md +42 -29
- package/docs/usage.es.md +98 -50
- package/docs/usage.ja.md +71 -23
- package/docs/usage.ko.md +100 -52
- package/docs/usage.md +51 -3
- package/docs/usage.zh.md +95 -47
- package/package.json +11 -2
package/README.zh.md
CHANGED
|
@@ -19,213 +19,230 @@
|
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
|
-
这是为那些日常工作横跨多个仓库、产品、客户和工作流的开发者准备的。
|
|
23
|
-
|
|
24
|
-
`gc-tree` 给 AI 编码工具补上了一层 **仓库之上的可复用上下文层**。该长期保留的上下文可以留下来,只在相关仓库里生效,不相关的时候就安静退场。
|
|
25
|
-
|
|
26
22
|
---
|
|
27
23
|
|
|
28
|
-
##
|
|
24
|
+
## 问题所在
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
你每天都在用 Claude Code 或 Codex。但你的实际工作横跨多个仓库、产品和客户——而 AI 工具只认识当前文件。
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
于是你不得不一遍遍地做这些事:
|
|
33
29
|
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
- 每次切换工作流,都得靠人脑手动切换上下文
|
|
30
|
+
- 重新解释哪些仓库属于同一套系统
|
|
31
|
+
- 把同一份架构文档反复粘贴进提示词
|
|
32
|
+
- 提醒 AI 它上周"已经知道"的编码规范
|
|
33
|
+
- 手动剔除与当前仓库无关的上下文
|
|
39
34
|
|
|
40
|
-
|
|
35
|
+
这不是 AI 的问题,而是**上下文管理的问题**。
|
|
41
36
|
|
|
42
37
|
---
|
|
43
38
|
|
|
44
|
-
##
|
|
39
|
+
## 安装与快速开始
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g @handsupmin/gc-tree
|
|
43
|
+
gctree init
|
|
44
|
+
```
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
可以明确指定某条上下文只该作用于哪些仓库。
|
|
46
|
+
`gctree init` 会引导你:
|
|
51
47
|
|
|
52
|
-
-
|
|
53
|
-
|
|
48
|
+
1. 选择 provider:`claude-code`、`codex` 或 `both`
|
|
49
|
+
2. 在当前仓库安装集成文件
|
|
50
|
+
3. 为 `main` gc-branch 完成引导式 onboarding
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
可以用 Codex、Claude Code,或者两者一起,把上下文建立起来并持续维护。
|
|
52
|
+
之后,AI 工具会自动学会在规划或实现前调用 `gctree resolve`。
|
|
57
53
|
|
|
58
|
-
- **
|
|
59
|
-
|
|
54
|
+
- **CLI:** `gctree`
|
|
55
|
+
- **要求:** Node.js 20+
|
|
60
56
|
|
|
61
57
|
---
|
|
62
58
|
|
|
63
|
-
##
|
|
59
|
+
## 适合哪些人
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
npm install -g @handsupmin/gc-tree
|
|
67
|
-
gctree init
|
|
68
|
-
```
|
|
61
|
+
如果以下几条符合你的情况,gc-tree 会很适合你:
|
|
69
62
|
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
- 工作横跨**多个仓库**(单体仓库团队、平台 + 客户仓库、后端 + 前端技术栈)
|
|
64
|
+
- 同一周内要在**多个产品或客户**之间来回切换
|
|
65
|
+
- 每次开 AI 会话都要**重复解释相同的上下文**
|
|
66
|
+
- 希望 AI 工具不只了解当前文件,还能理解**编码规范、架构和领域知识**
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
- **要求:** Node.js 20+
|
|
75
|
-
|
|
76
|
-
如果你想从源码开发,请看 [docs/local-development.zh.md](https://github.com/handsupmin/gc-tree/blob/main/docs/local-development.zh.md)。
|
|
68
|
+
如果你只在一个仓库、一个产品里工作,不需要这个工具。`CLAUDE.md` 或 `.cursorrules` 就够了。
|
|
77
69
|
|
|
78
70
|
---
|
|
79
71
|
|
|
80
|
-
##
|
|
72
|
+
## gc-tree 做什么
|
|
81
73
|
|
|
82
|
-
|
|
74
|
+
`gc-tree` 工作在**仓库之上**。它把上下文存储为结构化的 Markdown 文件,让 AI 工具在每次会话前自动拉取相关内容。
|
|
83
75
|
|
|
84
76
|
```bash
|
|
85
|
-
gctree
|
|
86
|
-
gctree onboard
|
|
77
|
+
gctree resolve --query "auth token rotation policy"
|
|
87
78
|
```
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"gc_branch": "main",
|
|
83
|
+
"matches": [
|
|
84
|
+
{
|
|
85
|
+
"title": "认证与 Session 规范",
|
|
86
|
+
"score": 4,
|
|
87
|
+
"summary": "每次请求都做 JWT rotation,refresh token 存在 httpOnly cookie 里,access token TTL 15 分钟",
|
|
88
|
+
"excerpt": "## 认证流程\nAccess token:15 分钟 TTL,每次认证请求都做 rotation..."
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
95
92
|
```
|
|
96
93
|
|
|
97
|
-
|
|
94
|
+
AI 工具拿到的是正确的上下文——不是整个知识库,而是恰好相关的那一片。
|
|
98
95
|
|
|
99
|
-
|
|
96
|
+
**实测:每次查询只注入约 4% 的总上下文。** 其余 96% 留在磁盘上,真正需要时才进入 token 窗口。
|
|
100
97
|
|
|
101
|
-
|
|
102
|
-
gctree update-gc
|
|
103
|
-
gctree ugc
|
|
104
|
-
```
|
|
98
|
+
---
|
|
105
99
|
|
|
106
|
-
|
|
100
|
+
## 和 CLAUDE.md 或 cursor rules 有什么区别?
|
|
107
101
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
`CLAUDE.md` 很好用——在单个仓库里。
|
|
103
|
+
|
|
104
|
+
一旦你有了多个仓库、客户或工作线:
|
|
111
105
|
|
|
112
|
-
|
|
106
|
+
| | `CLAUDE.md` / cursor rules | `gc-tree` |
|
|
107
|
+
| ---------------- | -------------------------- | -------------------------- |
|
|
108
|
+
| 作用范围 | 单个仓库 | 多个仓库,一套上下文 |
|
|
109
|
+
| 持久化方式 | 仓库内的文件 | 存储在仓库外,跨会话复用 |
|
|
110
|
+
| 切换上下文 | 手动编辑文件 | `gctree checkout client-b` |
|
|
111
|
+
| 相关性过滤 | 全部或全无 | 只注入匹配的文档(约 4%) |
|
|
112
|
+
| 初始化方式 | 手写 | 由 AI 工具引导完成 |
|
|
113
|
+
| 支持 Codex | ✅ | ✅ |
|
|
114
|
+
| 支持 Claude Code | ✅ | ✅ |
|
|
113
115
|
|
|
114
116
|
---
|
|
115
117
|
|
|
116
|
-
##
|
|
118
|
+
## 经过验证的性能
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
基于真实内部文档测试(4 份 Notion 导出,中英文混合查询):
|
|
119
121
|
|
|
120
|
-
|
|
122
|
+
| 指标 | 结果 |
|
|
123
|
+
| ------------------------------------- | ----------------- |
|
|
124
|
+
| Recall——相关查询找到正确文档的比例 | **100%**(16/16) |
|
|
125
|
+
| Precision——无关查询返回空结果的比例 | **80%**(4/5) |
|
|
126
|
+
| F1 分数 | **88.9%** |
|
|
127
|
+
| 每次查询注入的 token 占总上下文的比例 | **约 4%** |
|
|
128
|
+
| 支持中英文混合查询 | ✅ |
|
|
121
129
|
|
|
122
|
-
|
|
123
|
-
- 产品线
|
|
124
|
-
- 平台团队
|
|
125
|
-
- 一起演进的后端 + 前端技术栈
|
|
126
|
-
- 临时专项或迁移项目
|
|
130
|
+
---
|
|
127
131
|
|
|
128
|
-
|
|
132
|
+
## Claude Code 和 Codex 均已验证可用
|
|
129
133
|
|
|
130
134
|
```bash
|
|
131
|
-
gctree
|
|
132
|
-
gctree
|
|
135
|
+
gctree scaffold --host claude-code # 安装 CLAUDE.md 片段 + /gc-onboard、/gc-update-global-context
|
|
136
|
+
gctree scaffold --host codex # 安装 AGENTS.md 片段 + $gc-onboard、$gc-update-global-context
|
|
137
|
+
gctree scaffold --host both # 两者同时安装
|
|
133
138
|
```
|
|
134
139
|
|
|
135
|
-
|
|
140
|
+
两个 provider 使用同一个底层上下文存储。onboard 一次,两个工具都能用。
|
|
136
141
|
|
|
137
|
-
|
|
142
|
+
**Claude Code** — 使用 `/gc-resolve-context`、`/gc-onboard`、`/gc-update-global-context` 斜杠命令。
|
|
138
143
|
|
|
139
|
-
|
|
144
|
+
**Codex** — 使用 `$gc-resolve-context`、`$gc-onboard`、`$gc-update-global-context` skill。已通过 `codex exec` 实际验证:
|
|
140
145
|
|
|
141
|
-
|
|
146
|
+
```
|
|
147
|
+
gctree status → gc_branch: main,doc_count: 2
|
|
148
|
+
gctree resolve --query 'NestJS DTO plainToInstance'
|
|
149
|
+
→ 匹配到"后端编码规范"(score: 3)
|
|
150
|
+
→ DTO:class-transformer plainToInstance,class-validator 必填
|
|
151
|
+
→ 错误处理:基于 HttpException 的自定义异常,禁止直接抛出 raw Error
|
|
152
|
+
```
|
|
142
153
|
|
|
143
|
-
|
|
154
|
+
---
|
|
144
155
|
|
|
145
|
-
|
|
156
|
+
## 常用操作
|
|
146
157
|
|
|
147
|
-
|
|
148
|
-
- 两个客户项目仓库
|
|
149
|
-
- 一个内部工具仓库
|
|
158
|
+
### 为不同工作线创建独立上下文
|
|
150
159
|
|
|
151
|
-
|
|
160
|
+
```bash
|
|
161
|
+
gctree checkout -b client-b
|
|
162
|
+
gctree onboard
|
|
163
|
+
```
|
|
152
164
|
|
|
153
|
-
-
|
|
154
|
-
- 哪些仓库其实是一组
|
|
155
|
-
- 当前最重要的工作流是什么
|
|
156
|
-
- 哪些上下文放进来反而会干扰
|
|
165
|
+
每个 gc-branch 都是完全独立的上下文通道,像 Git 分支一样自由切换。
|
|
157
166
|
|
|
158
|
-
|
|
167
|
+
### 按需拉取相关上下文
|
|
159
168
|
|
|
160
|
-
|
|
169
|
+
```bash
|
|
170
|
+
gctree resolve --query "billing retry policy"
|
|
171
|
+
```
|
|
161
172
|
|
|
162
|
-
|
|
173
|
+
只返回匹配的文档——标题、摘要和摘录。摘要不够用时,工具才会读完整文档。
|
|
163
174
|
|
|
164
|
-
|
|
175
|
+
### 保持上下文与时俱进
|
|
165
176
|
|
|
166
|
-
|
|
177
|
+
```bash
|
|
178
|
+
gctree update-global-context # 或:gctree update-gc / gctree ugc
|
|
179
|
+
```
|
|
167
180
|
|
|
168
|
-
|
|
169
|
-
面向某个产品、客户、工作流或领域的一条长期上下文线。
|
|
181
|
+
引导式更新流程——AI 工具询问发生了哪些变化,并将新上下文写回 gc-branch。
|
|
170
182
|
|
|
171
|
-
|
|
172
|
-
决定这条上下文应该在哪些仓库里生效的规则。
|
|
183
|
+
### 限定上下文作用的仓库范围
|
|
173
184
|
|
|
174
|
-
|
|
175
|
-
|
|
185
|
+
```bash
|
|
186
|
+
gctree set-repo-scope --branch client-b --include # 包含当前仓库
|
|
187
|
+
gctree set-repo-scope --branch client-b --exclude # 排除当前仓库
|
|
188
|
+
```
|
|
176
189
|
|
|
177
|
-
-
|
|
178
|
-
在实现上,`gc-tree` 把上下文组织成一棵按分支感知、由文件承载的知识树。
|
|
179
|
-
对用户来说,核心价值就是:项目之外也能复用的上下文。
|
|
190
|
+
`gc-tree` 不会向不相关的仓库注入上下文。
|
|
180
191
|
|
|
181
192
|
---
|
|
182
193
|
|
|
183
|
-
##
|
|
184
|
-
|
|
185
|
-
scaffold 完成后,运行时可见的命令是:
|
|
194
|
+
## 上下文的存储结构
|
|
186
195
|
|
|
187
|
-
|
|
188
|
-
|
|
196
|
+
```
|
|
197
|
+
~/.gctree/
|
|
198
|
+
branches/
|
|
199
|
+
main/
|
|
200
|
+
index.md ← 压缩索引,≤2000 字符,优先加载
|
|
201
|
+
docs/
|
|
202
|
+
auth.md ← 完整文档,按需读取
|
|
203
|
+
architecture.md
|
|
204
|
+
client-b/
|
|
205
|
+
index.md
|
|
206
|
+
docs/
|
|
207
|
+
...
|
|
208
|
+
branch-repo-map.json ← 哪些仓库属于哪个 gc-branch
|
|
209
|
+
settings.json ← 首选 provider、语言
|
|
210
|
+
```
|
|
189
211
|
|
|
190
|
-
|
|
212
|
+
上下文存储在仓库之外——无需 `.gitignore` 规则,不会误提交,使用同一 gc-branch 的所有项目都可复用。
|
|
191
213
|
|
|
192
214
|
---
|
|
193
215
|
|
|
194
|
-
##
|
|
195
|
-
|
|
196
|
-
| 目标
|
|
197
|
-
|
|
|
198
|
-
| 初始化 gc-tree 并选择 provider
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-
|
|
|
202
|
-
|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
|
|
|
216
|
+
## 核心命令
|
|
217
|
+
|
|
218
|
+
| 目标 | 命令 |
|
|
219
|
+
| ------------------------------------ | --------------------------------------------------------------- |
|
|
220
|
+
| 初始化 gc-tree 并选择 provider | `gctree init` |
|
|
221
|
+
| 确认当前激活的 gc-branch | `gctree status` |
|
|
222
|
+
| 搜索当前上下文 | `gctree resolve --query "..."` |
|
|
223
|
+
| 创建或切换 gc-branch | `gctree checkout <branch>` / `gctree checkout -b <branch>` |
|
|
224
|
+
| 列出所有 gc-branch | `gctree branches` |
|
|
225
|
+
| 对空 gc-branch 进行引导式 onboarding | `gctree onboard` |
|
|
226
|
+
| 对当前 gc-branch 进行引导式更新 | `gctree update-global-context` / `gctree ugc` |
|
|
227
|
+
| 查看仓库范围规则 | `gctree repo-map` |
|
|
228
|
+
| 为 gc-branch 包含或排除当前仓库 | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
|
|
229
|
+
| 重新 onboarding 前重置 gc-branch | `gctree reset-gc-branch --branch <name> --yes` |
|
|
230
|
+
| 在新环境中安装 scaffold | `gctree scaffold --host codex --target /path/to/repo` |
|
|
208
231
|
|
|
209
232
|
---
|
|
210
233
|
|
|
211
234
|
## 文档
|
|
212
235
|
|
|
213
|
-
详细文档位于 [`docs/`](https://github.com/handsupmin/gc-tree/tree/main/docs) 目录下。
|
|
214
|
-
|
|
215
236
|
- **概念** — [`docs/concept.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/concept.zh.md)
|
|
216
|
-
说明 `gctree` 是什么、解决什么问题,以及全局上下文层的边界。
|
|
217
237
|
- **原理** — [`docs/principles.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/principles.zh.md)
|
|
218
|
-
介绍 gc-branch、仓库范围、summary-first 文档和引导式更新等原则。
|
|
219
238
|
- **使用方法** — [`docs/usage.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/usage.zh.md)
|
|
220
|
-
|
|
221
|
-
- **本地运行方法** — [`docs/local-development.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/local-development.zh.md)
|
|
222
|
-
说明依赖安装、本地运行 CLI 与提交前验证方式。
|
|
239
|
+
- **本地开发** — [`docs/local-development.zh.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/local-development.zh.md)
|
|
223
240
|
|
|
224
241
|
---
|
|
225
242
|
|
|
226
243
|
## 贡献
|
|
227
244
|
|
|
228
|
-
欢迎贡献。开发流程与 PR
|
|
245
|
+
欢迎贡献。开发流程与 PR 检查清单见 [CONTRIBUTING.md](https://github.com/handsupmin/gc-tree/blob/main/CONTRIBUTING.md)。
|
|
229
246
|
|
|
230
247
|
---
|
|
231
248
|
|
package/dist/src/resolve.js
CHANGED
|
@@ -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
|
-
|
|
6
|
-
|
|
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(/[
|
|
9
|
-
.filter((
|
|
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) =>
|
|
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
|
-
|
|
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({
|
package/docs/concept.es.md
CHANGED
|
@@ -4,49 +4,61 @@
|
|
|
4
4
|
|
|
5
5
|
## Resumen
|
|
6
6
|
|
|
7
|
-
`gctree` es una capa
|
|
7
|
+
`gctree` es una capa de contexto global ligera para herramientas de programación con IA. Mantiene el contexto de larga duración 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 corresponde.
|
|
8
8
|
|
|
9
9
|
## Qué es `gctree`
|
|
10
10
|
|
|
11
11
|
`gctree` es una CLI para gestionar contexto global reutilizable.
|
|
12
|
-
Está pensada para
|
|
12
|
+
Está pensada para personas y equipos que quieren que el contexto importante persista entre repositorios, sesiones y herramientas sin convertirse en memoria oculta.
|
|
13
13
|
|
|
14
|
-
En lugar de
|
|
14
|
+
En lugar de dispersar conocimiento clave entre archivos de prompt, notas locales de cada repositorio e instrucciones puntuales, `gctree` le da a ese conocimiento un lugar estable y respaldado por archivos donde vivir.
|
|
15
15
|
|
|
16
16
|
## Qué problema resuelve
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Muchas configuraciones de programación con IA empiezan siendo pequeñas:
|
|
19
19
|
|
|
20
20
|
- un `AGENTS.md`
|
|
21
21
|
- un `CLAUDE.md`
|
|
22
|
-
- un archivo de prompt
|
|
23
|
-
-
|
|
22
|
+
- un archivo de prompt local en el repositorio
|
|
23
|
+
- algunas notas copiadas en los prompts cuando se necesitan
|
|
24
24
|
|
|
25
|
-
Eso funciona
|
|
25
|
+
Eso funciona un tiempo. Luego llega el trabajo real y comienzan a aparecer las fisuras:
|
|
26
26
|
|
|
27
|
-
-
|
|
28
|
-
- el trabajo para clientes
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- el contexto
|
|
32
|
-
- una
|
|
27
|
+
- diferentes productos necesitan contexto diferente
|
|
28
|
+
- el trabajo para clientes necesita un aislamiento limpio
|
|
29
|
+
- las guías reutilizables deberían vivir fuera de cualquier repositorio individual
|
|
30
|
+
- múltiples herramientas deberían poder leer la misma fuente de verdad
|
|
31
|
+
- el contexto de larga duración debería cambiar mediante un flujo explícito y revisable
|
|
32
|
+
- una persona puede tener muchas sesiones abiertas en varios repositorios al mismo tiempo
|
|
33
33
|
|
|
34
|
-
`gctree` existe para
|
|
34
|
+
`gctree` existe para gestionar esa capa de forma limpia.
|
|
35
|
+
|
|
36
|
+
## Cómo funciona resolve
|
|
37
|
+
|
|
38
|
+
Cuando una herramienta llama a `gctree resolve --query "..."`, gc-tree puntúa cada documento de la gc-branch activa contra la consulta usando coincidencia de palabras clave con soporte Unicode (las consultas en coreano, CJK e idiomas mixtos funcionan igual que en inglés). Las coincidencias en el título cuentan el doble que las coincidencias en el cuerpo.
|
|
39
|
+
|
|
40
|
+
La herramienta recibe únicamente los documentos que coinciden — título, resumen y fragmento — no la base de conocimiento completa. En la práctica, esto significa que se inyecta aproximadamente el 4 % del contexto total por consulta. La herramienta lee el documento completo solo cuando el resumen no es suficiente.
|
|
41
|
+
|
|
42
|
+
Esto mantiene el uso de tokens bajo sin ocultar nada. Todo el contexto sigue siendo explícito, respaldado por archivos y revisable.
|
|
43
|
+
|
|
44
|
+
## Compatibilidad con proveedores
|
|
45
|
+
|
|
46
|
+
`gctree` funciona tanto con Claude Code como con Codex. Ambos proveedores usan el mismo almacén de contexto subyacente. Haz scaffold una vez y ambas herramientas podrán hacer resolve, onboard y actualizar el contexto desde la misma gc-branch.
|
|
35
47
|
|
|
36
48
|
## Límite de alcance
|
|
37
49
|
|
|
38
|
-
`gctree` no
|
|
50
|
+
`gctree` intencionalmente no es:
|
|
39
51
|
|
|
40
|
-
- un orquestador
|
|
52
|
+
- un orquestador de entregas de solicitud a commit
|
|
41
53
|
- un sistema de memoria oculta
|
|
42
|
-
- un
|
|
54
|
+
- un entorno de colaboración en el navegador
|
|
43
55
|
- un producto de base de conocimiento de propósito general
|
|
44
56
|
|
|
45
|
-
Se
|
|
57
|
+
Se centra en un único trabajo: gestionar gc-branches de contexto global reutilizable y actualizaciones duraderas explícitas.
|
|
46
58
|
|
|
47
59
|
## Modelo de archivos
|
|
48
60
|
|
|
49
|
-
Un directorio
|
|
61
|
+
Un directorio de inicio típico tiene este aspecto:
|
|
50
62
|
|
|
51
63
|
```text
|
|
52
64
|
~/.gctree/
|
|
@@ -60,22 +72,22 @@ Un directorio personal típico queda así:
|
|
|
60
72
|
docs/
|
|
61
73
|
```
|
|
62
74
|
|
|
63
|
-
- `HEAD`
|
|
64
|
-
- `settings.json`
|
|
65
|
-
- `branch-repo-map.json`
|
|
66
|
-
- `branch.json`
|
|
67
|
-
- `index.md` es el punto de entrada compacto para herramientas
|
|
68
|
-
- `docs/` contiene los documentos markdown que
|
|
75
|
+
- `HEAD` registra la gc-branch activa predeterminada.
|
|
76
|
+
- `settings.json` almacena el modo de proveedor, el proveedor de onboarding elegido para el lanzamiento en tiempo de ejecución y el idioma de trabajo preferido.
|
|
77
|
+
- `branch-repo-map.json` almacena qué repositorios están incluidos o excluidos para cada gc-branch.
|
|
78
|
+
- `branch.json` almacena metadatos ligeros de la gc-branch.
|
|
79
|
+
- `index.md` es el punto de entrada compacto para las herramientas — se mantiene por debajo de 2000 caracteres para que cargue rápido sin consumir un presupuesto significativo de tokens.
|
|
80
|
+
- `docs/` contiene los documentos markdown que son la fuente de verdad.
|
|
69
81
|
|
|
70
|
-
## Comportamiento
|
|
82
|
+
## Comportamiento según el repositorio
|
|
71
83
|
|
|
72
|
-
|
|
73
|
-
Si la
|
|
84
|
+
Una gc-branch no tiene que aplicarse en todos lados.
|
|
85
|
+
Si la branch `A` solo es relevante para los repositorios `B`, `C` y `D`, `gctree` puede registrar eso en `branch-repo-map.json`.
|
|
74
86
|
|
|
75
|
-
Cuando `gctree resolve` se ejecuta
|
|
87
|
+
Cuando `gctree resolve` se ejecuta en otro repositorio como `F`, puede:
|
|
76
88
|
|
|
77
|
-
- continuar
|
|
78
|
-
- usar siempre
|
|
79
|
-
- ignorar
|
|
89
|
+
- continuar una vez
|
|
90
|
+
- usar siempre esa gc-branch en `F`
|
|
91
|
+
- ignorar esa gc-branch en `F`
|
|
80
92
|
|
|
81
|
-
|
|
93
|
+
Esto hace que gc-tree sea mucho más seguro para usuarios avanzados que mantienen muchas sesiones paralelas abiertas en repositorios no relacionados.
|