@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.md CHANGED
@@ -19,44 +19,33 @@ Manage multiple contexts like Git branches.
19
19
 
20
20
  </div>
21
21
 
22
- Built for developers whose real work spans **multiple repos, products, clients, and workflows**.
23
-
24
- `gc-tree` gives AI coding tools a reusable context layer **above the repo level**. Keep long-lived context across sessions, scope it to the right repos, and let `gc-tree` stay out of the way when the current repo is unrelated.
25
-
26
22
  ---
27
23
 
28
- ## Why gc-tree?
24
+ ## The problem
29
25
 
30
- If you use AI agents seriously, repo-local context stops being enough.
26
+ You use Claude Code or Codex every day. But your real work spans multiple repos, products, and clients and your AI tools only know about the current file.
31
27
 
32
- Once your work spans multiple repos and workstreams, the usual setup starts to break:
28
+ So you end up doing this every session:
33
29
 
34
- - durable context gets stuffed into prompts
35
- - unrelated context leaks into the wrong repo
36
- - every new session needs the same onboarding again
37
- - client or product knowledge lives in hidden chat history
38
- - switching workstreams means manually switching mental context too
30
+ - Re-explain which repos belong together
31
+ - Paste the same architecture doc into the prompt again
32
+ - Remind the agent about conventions it already "knew" last week
33
+ - Manually strip context that's irrelevant to the current repo
39
34
 
40
- `gc-tree` is for the people who already use Codex, Claude Code, and other AI coding tools heavily — and want context management to stop being another manual workflow.
35
+ That's not an AI problem. It's a **context management problem**.
41
36
 
42
37
  ---
43
38
 
44
- ## What you get
45
-
46
- - **Multiple durable contexts**
47
- Keep separate context lanes for different products, clients, or workstreams.
39
+ ## Who this is for
48
40
 
49
- - **Repo-scoped relevance**
50
- Map each context to the repos where it actually belongs.
41
+ You'll get the most out of `gc-tree` if you:
51
42
 
52
- - **Smart scope guard**
53
- If you enter a repo that is not mapped yet, `gc-tree` can ask whether to continue once, always use this context here, or ignore it here.
43
+ - Work across **multiple repos** (monorepo teams, platform + client repos, backend + frontend stacks)
44
+ - Switch between **multiple products or clients** in the same week
45
+ - Find yourself **re-explaining the same context** at the start of every AI session
46
+ - Want AI tools to understand your **conventions, architecture, and domain knowledge** — not just the current file
54
47
 
55
- - **Guided onboarding and updates**
56
- Use Codex, Claude Code, or both to onboard and maintain context over time.
57
-
58
- - **Summary-first markdown knowledge**
59
- Store reusable context in files, not hidden memory, and let tools read the short version first.
48
+ If you only ever work in one repo and one product, you probably don't need this. `CLAUDE.md` or `.cursorrules` is enough.
60
49
 
61
50
  ---
62
51
 
@@ -67,160 +56,187 @@ npm install -g @handsupmin/gc-tree
67
56
  gctree init
68
57
  ```
69
58
 
70
- That is enough to get started.
71
- After that, keep working the way you already do — `gc-tree` adds a reusable global context lane around your normal workflow.
59
+ `gctree init` walks you through:
60
+
61
+ 1. Choose provider: `claude-code`, `codex`, or `both`
62
+ 2. Scaffold the integration files into your current repo
63
+ 3. Run guided onboarding for the `main` gc-branch
72
64
 
73
- - **CLI command:** `gctree`
74
- - **Requirements:** Node.js 20+
65
+ After that, your AI tool will know to call `gctree resolve` before planning or implementing.
75
66
 
76
- For source-based development, see [docs/local-development.md](https://github.com/handsupmin/gc-tree/blob/main/docs/local-development.md).
67
+ - **CLI:** `gctree`
68
+ - **Requires:** Node.js 20+
77
69
 
78
70
  ---
79
71
 
80
- ## Common moves
72
+ ## What gc-tree does
81
73
 
82
- ### Create a new context when a workstream deserves its own lane
74
+ `gc-tree` sits **above the repo level**. It stores durable context in structured markdown files and lets your AI tools pull only what's relevant — before each session, automatically.
83
75
 
84
76
  ```bash
85
- gctree checkout -b client-b
86
- gctree onboard
77
+ gctree resolve --query "auth token rotation policy"
87
78
  ```
88
79
 
89
- When a client, product, migration, or initiative deserves its own durable lane, give it its own gc-branch.
90
-
91
- ### Update durable context later
92
-
93
- ```bash
94
- gctree update-global-context
80
+ ```json
81
+ {
82
+ "gc_branch": "main",
83
+ "matches": [
84
+ {
85
+ "title": "Auth & Session Conventions",
86
+ "score": 4,
87
+ "summary": "JWT rotation on every request, refresh tokens stored in httpOnly cookies, 15-min access token TTL",
88
+ "excerpt": "## Auth Flow\nAccess token: 15-min TTL, rotated on every authenticated request..."
89
+ }
90
+ ]
91
+ }
95
92
  ```
96
93
 
97
- Refresh the active gc-branch as the work evolves.
94
+ Your AI tool gets the right context. Not the whole knowledge base — just the relevant slice.
98
95
 
99
- Short aliases:
96
+ **In practice: only ~4% of your total context is injected per query.** The other 96% stays on disk, out of the token window, until it's actually needed.
100
97
 
101
- ```bash
102
- gctree update-gc
103
- gctree ugc
104
- ```
98
+ ---
105
99
 
106
- ### Resolve context when you need it
100
+ ## Why not just use CLAUDE.md or cursor rules?
107
101
 
108
- ```bash
109
- gctree resolve --query "auth token rotation"
110
- ```
102
+ `CLAUDE.md` is great — for one repo.
103
+
104
+ The moment you have multiple repos, clients, or workstreams:
111
105
 
112
- Pull relevant context back into the current moment when you want it.
106
+ | | `CLAUDE.md` / cursor rules | `gc-tree` |
107
+ | ---------------------- | -------------------------- | -------------------------------------------- |
108
+ | Scope | One repo | Multiple repos, one context |
109
+ | Persistence | Per-repo file | Stored outside repos, reused across sessions |
110
+ | Switching contexts | Manual file edits | `gctree checkout client-b` |
111
+ | Relevance filtering | Everything or nothing | Only injects matching docs (~4% of total) |
112
+ | Onboarding | Hand-written | Guided by your AI tool |
113
+ | Works with Codex | ✅ | ✅ |
114
+ | Works with Claude Code | ✅ | ✅ |
113
115
 
114
116
  ---
115
117
 
116
- ## Why it feels natural
118
+ ## Validated performance
117
119
 
118
- **Keep multiple contexts like Git branches without babysitting them like Git branches.**
120
+ Tested against real internal documentation (4 Notion exports, Korean + English mixed queries):
119
121
 
120
- You can create separate contexts for:
122
+ | Metric | Result |
123
+ | -------------------------------------------- | ---------------- |
124
+ | Recall — relevant queries find the right doc | **100%** (16/16) |
125
+ | Precision — irrelevant queries return empty | **80%** (4/5) |
126
+ | F1 score | **88.9%** |
127
+ | Tokens injected per query vs. total context | **~4%** |
128
+ | Works with mixed Korean + English queries | ✅ |
121
129
 
122
- - a client
123
- - a product line
124
- - a platform team
125
- - a shared backend + frontend stack
126
- - a temporary initiative or migration
130
+ ---
127
131
 
128
- Then switch between them with familiar branch-like commands:
132
+ ## Works with Claude Code and Codex — both verified
129
133
 
130
134
  ```bash
131
- gctree checkout -b client-b
132
- gctree checkout main
135
+ gctree scaffold --host claude-code # installs CLAUDE.md snippet + /gc-onboard, /gc-update-global-context
136
+ gctree scaffold --host codex # installs AGENTS.md snippet + $gc-onboard, $gc-update-global-context
137
+ gctree scaffold --host both # both at once
133
138
  ```
134
139
 
135
- But unlike Git, you do **not** have to manually manage that switch all the time.
140
+ Both providers use the same underlying context store. Onboard once, use from either tool.
136
141
 
137
- If the repo you are in is outside the scope of the current context, `gc-tree` can detect that and treat the context as irrelevant instead of leaking it into the wrong session.
142
+ **Claude Code** uses `/gc-resolve-context`, `/gc-onboard`, `/gc-update-global-context` slash commands.
138
143
 
139
- That means you can keep multiple long-lived contexts around without dragging unrelated context into every tool session.
144
+ **Codex** uses `$gc-resolve-context`, `$gc-onboard`, `$gc-update-global-context` skills. Verified with `codex exec`:
140
145
 
141
- ---
146
+ ```
147
+ gctree status → gc_branch: main, doc_count: 2
148
+ gctree resolve --query 'NestJS DTO plainToInstance'
149
+ → matched "Backend Coding Conventions" (score: 3)
150
+ → DTO: class-transformer plainToInstance, class-validator required
151
+ → Error handling: HttpException-based custom exceptions, no raw Error throws
152
+ ```
142
153
 
143
- ## A realistic workflow
154
+ ---
144
155
 
145
- You work across:
156
+ ## Common moves
146
157
 
147
- - one shared platform repo
148
- - two client repos
149
- - one internal tooling repo
158
+ ### Separate contexts for separate workstreams
150
159
 
151
- Without `gc-tree`, every AI session has to be re-taught:
160
+ ```bash
161
+ gctree checkout -b client-b
162
+ gctree onboard
163
+ ```
152
164
 
153
- - which client this is
154
- - which repos belong together
155
- - which workflows matter here
156
- - which context is irrelevant right now
165
+ Each gc-branch is a fully independent context lane. Switch between them like Git branches.
157
166
 
158
- With `gc-tree`, you can keep separate contexts for each lane, reuse them across sessions, and let repo-scope rules prevent irrelevant context from showing up where it should not.
167
+ ### Pull relevant context on demand
159
168
 
160
- This is the real job to be done:
169
+ ```bash
170
+ gctree resolve --query "billing retry policy"
171
+ ```
161
172
 
162
- > not “store more prompt text,”
163
- > but **manage the right context at the right level of work**.
173
+ Returns only the matching docs — title, summary, and excerpt. Your tool reads the full doc only if the summary isn't enough.
164
174
 
165
- ---
175
+ ### Keep context current
166
176
 
167
- ## Core concepts
177
+ ```bash
178
+ gctree update-global-context # or: gctree update-gc / gctree ugc
179
+ ```
168
180
 
169
- - **gc-branch**
170
- A durable context lane for one product, client, workstream, or domain.
181
+ Guided update flow — your AI tool asks what changed and writes the new context back to the gc-branch.
171
182
 
172
- - **repo scope**
173
- Rules that decide which repos a context should apply to.
183
+ ### Scope a context to specific repos
174
184
 
175
- - **provider-guided flow**
176
- Use your preferred AI coding tool to onboard and update context instead of hand-authoring JSON.
185
+ ```bash
186
+ gctree set-repo-scope --branch client-b --include # include current repo
187
+ gctree set-repo-scope --branch client-b --exclude # exclude current repo
188
+ ```
177
189
 
178
- - **context tree**
179
- Under the hood, `gc-tree` organizes context as branch-aware, file-backed knowledge.
180
- The “tree” is the implementation model; the user-facing benefit is reusable context beyond the project.
190
+ `gc-tree` won't inject a context into repos where it doesn't belong.
181
191
 
182
192
  ---
183
193
 
184
- ## Provider-facing commands inside the runtime
194
+ ## How context is stored
185
195
 
186
- After scaffolding, the visible commands are:
187
-
188
- - **Codex:** `$gc-onboard`, `$gc-update-global-context`
189
- - **Claude Code:** `/gc-onboard`, `/gc-update-global-context`
196
+ ```
197
+ ~/.gctree/
198
+ branches/
199
+ main/
200
+ index.md ← compact index, ≤2000 chars, loaded first
201
+ docs/
202
+ auth.md ← full doc, read only when needed
203
+ architecture.md
204
+ client-b/
205
+ index.md
206
+ docs/
207
+ ...
208
+ branch-repo-map.json ← which repos belong to which gc-branch
209
+ settings.json ← preferred provider, language
210
+ ```
190
211
 
191
- Those commands should always mention the current active gc-branch before gathering or updating durable context, and they should keep using the saved workflow language unless the user explicitly asks to switch.
212
+ Context lives outside your repos no `.gitignore` rules needed, no accidental commits, reusable across every project that uses the same gc-branch.
192
213
 
193
214
  ---
194
215
 
195
- ## Core commands at a glance
196
-
197
- | Goal | Command |
198
- | ------------------------------------------------- | ------------------------------------------------------------------ |
199
- | Initialize gc-tree and choose a provider | `gctree init` |
200
- | Confirm the active gc-branch | `gctree status` |
201
- | Search the active context | `gctree resolve --query "..."` |
202
- | Show repo-scope rules | `gctree repo-map` |
203
- | Explicitly include/exclude a repo for a gc-branch | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
204
- | Create or switch gc-branches | `gctree checkout <branch>` / `gctree checkout -b <branch>` |
205
- | Guided onboarding for an empty gc-branch | `gctree onboard` |
206
- | Guided durable update for the active gc-branch | `gctree update-global-context` / `gctree update-gc` / `gctree ugc` |
207
- | Reset a gc-branch before re-onboarding | `gctree reset-gc-branch --branch <name> --yes` |
208
- | Scaffold another environment manually | `gctree scaffold --host codex --target /path/to/repo` |
216
+ ## Core commands
217
+
218
+ | Goal | Command |
219
+ | ---------------------------------------------- | --------------------------------------------------------------- |
220
+ | Initialize gc-tree and choose a provider | `gctree init` |
221
+ | Confirm the active gc-branch | `gctree status` |
222
+ | Search the active context | `gctree resolve --query "..."` |
223
+ | Create or switch gc-branches | `gctree checkout <branch>` / `gctree checkout -b <branch>` |
224
+ | List all gc-branches | `gctree branches` |
225
+ | Guided onboarding for an empty gc-branch | `gctree onboard` |
226
+ | Guided durable update for the active gc-branch | `gctree update-global-context` / `gctree ugc` |
227
+ | Show repo-scope rules | `gctree repo-map` |
228
+ | Include/exclude current repo for a gc-branch | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
229
+ | Reset a gc-branch before re-onboarding | `gctree reset-gc-branch --branch <name> --yes` |
230
+ | Scaffold a new environment | `gctree scaffold --host codex --target /path/to/repo` |
209
231
 
210
232
  ---
211
233
 
212
234
  ## Documentation
213
235
 
214
- Detailed docs live in the [`docs/`](https://github.com/handsupmin/gc-tree/tree/main/docs) directory.
215
-
216
236
  - **Concept** — [`docs/concept.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/concept.md)
217
- Learn what `gctree` is, which problem it solves, and what belongs in the global-context layer.
218
237
  - **Principles** — [`docs/principles.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/principles.md)
219
- Read the rules behind gc-branches, repo scope, slim indexes, summary-first docs, and guided updates.
220
238
  - **Usage** — [`docs/usage.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/usage.md)
221
- See the standard CLI flow, provider-facing commands, repo-scope behavior, and integration patterns.
222
239
  - **Local development** — [`docs/local-development.md`](https://github.com/handsupmin/gc-tree/blob/main/docs/local-development.md)
223
- Learn how to run the CLI locally and verify changes before contributing.
224
240
 
225
241
  ---
226
242