@first-tree-ai/context-tree 0.1.5 → 0.1.7-alpha.202609010710
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +7 -3
- package/.codex-plugin/plugin.json +16 -9
- package/README.md +150 -117
- package/dist/cli/index.mjs +955 -573
- package/dist/index.d.mts +64 -15
- package/dist/index.mjs +833 -471
- package/dist/{schemas-C4bs-FkC.d.mts → schemas-C_7izpsa.d.mts} +130 -134
- package/dist/{schemas-BWM6Q6iz.mjs → schemas-DKHE1sWt.mjs} +62 -51
- package/dist/schemas.d.mts +2 -2
- package/dist/schemas.mjs +2 -2
- package/docs/specification.md +158 -144
- package/hooks/session-start.mjs +5 -14
- package/package.json +1 -1
- package/policy/context-tree-policy.md +10 -12
- package/skills/context-tree-connect/SKILL.md +34 -0
- package/skills/context-tree-connect/agents/openai.yaml +4 -0
- package/skills/context-tree-create/SKILL.md +32 -0
- package/skills/context-tree-create/agents/openai.yaml +4 -0
- package/skills/context-tree-publish/SKILL.md +26 -0
- package/skills/context-tree-publish/agents/openai.yaml +4 -0
- package/skills/context-tree-publish/scripts/context-tree.mjs +41 -0
- package/skills/context-tree-read/SKILL.md +20 -43
- package/skills/context-tree-read/agents/openai.yaml +2 -2
- package/skills/context-tree-setup/SKILL.md +33 -0
- package/skills/context-tree-setup/agents/openai.yaml +4 -0
- package/skills/context-tree-setup/scripts/context-tree.mjs +41 -0
- package/skills/context-tree-write/SKILL.md +29 -125
- package/skills/context-tree-write/agents/openai.yaml +2 -2
- package/skills/context-tree-init/SKILL.md +0 -51
- package/skills/context-tree-init/agents/openai.yaml +0 -4
- package/skills/context-tree-link/SKILL.md +0 -45
- package/skills/context-tree-link/agents/openai.yaml +0 -4
- /package/skills/{context-tree-init → context-tree-connect}/scripts/context-tree.mjs +0 -0
- /package/skills/{context-tree-link → context-tree-create}/scripts/context-tree.mjs +0 -0
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
"url": "https://github.com/first-tree-ai"
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
|
-
"description": "Install the
|
|
8
|
+
"description": "Install the Context Tree plugin for durable project context."
|
|
9
9
|
},
|
|
10
10
|
"plugins": [
|
|
11
11
|
{
|
|
12
12
|
"name": "context-tree",
|
|
13
|
-
"description": "
|
|
13
|
+
"description": "Create, connect, read, write, and privately publish durable project context.",
|
|
14
14
|
"source": {
|
|
15
15
|
"source": "npm",
|
|
16
16
|
"package": "@first-tree-ai/context-tree",
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-tree",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.7-alpha.202609010710",
|
|
4
|
+
"description": "Durable project context for coding agents: set up, read, write, and privately publish a Context Tree.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "First Tree AI"
|
|
7
7
|
},
|
|
8
8
|
"homepage": "https://github.com/first-tree-ai/context-tree",
|
|
9
9
|
"repository": "https://github.com/first-tree-ai/context-tree",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
-
"keywords": [
|
|
11
|
+
"keywords": [
|
|
12
|
+
"context-tree",
|
|
13
|
+
"memory",
|
|
14
|
+
"agents"
|
|
15
|
+
]
|
|
12
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-tree",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.7-alpha.202609010710",
|
|
4
|
+
"description": "Durable project context for coding agents: set up, read, write, and privately publish a Context Tree.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "First Tree AI",
|
|
7
7
|
"url": "https://github.com/first-tree-ai"
|
|
@@ -9,21 +9,28 @@
|
|
|
9
9
|
"homepage": "https://github.com/first-tree-ai/context-tree",
|
|
10
10
|
"repository": "https://github.com/first-tree-ai/context-tree",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"context-tree",
|
|
14
|
+
"memory",
|
|
15
|
+
"agents"
|
|
16
|
+
],
|
|
13
17
|
"skills": "./skills/",
|
|
14
18
|
"hooks": "./hooks/hooks.json",
|
|
15
19
|
"interface": {
|
|
16
20
|
"displayName": "Context Tree",
|
|
17
|
-
"shortDescription": "
|
|
18
|
-
"longDescription": "
|
|
21
|
+
"shortDescription": "Read and write durable project context",
|
|
22
|
+
"longDescription": "Set up (create or connect) a verified Context Tree, read the decisions and constraints that bear on a task, record durable decisions, and publish local trees privately.",
|
|
19
23
|
"developerName": "First Tree AI",
|
|
20
24
|
"category": "Developer Tools",
|
|
21
|
-
"capabilities": [
|
|
25
|
+
"capabilities": [
|
|
26
|
+
"Read",
|
|
27
|
+
"Write"
|
|
28
|
+
],
|
|
22
29
|
"websiteURL": "https://github.com/first-tree-ai/context-tree",
|
|
23
30
|
"defaultPrompt": [
|
|
24
|
-
"
|
|
25
|
-
"Read the relevant Context Tree
|
|
26
|
-
"
|
|
31
|
+
"Set up a Context Tree (create or connect) when this project has none.",
|
|
32
|
+
"Read the relevant Context Tree decisions before changing this code.",
|
|
33
|
+
"Write this durable decision to the Context Tree."
|
|
27
34
|
]
|
|
28
35
|
}
|
|
29
36
|
}
|
package/README.md
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
# Context Tree
|
|
2
2
|
|
|
3
|
-
`@first-tree-ai/context-tree`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
v1 package and includes a CLI for shell automation.
|
|
3
|
+
`@first-tree-ai/context-tree` provides durable, structured project context for
|
|
4
|
+
coding agents. It ships a portable core, CLI, policy, templates, hook, and six
|
|
5
|
+
framework-neutral skills.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
supports repositories on GitHub.com only; GitHub Enterprise Server and other
|
|
12
|
-
forges are not supported.
|
|
7
|
+
A Context Tree records current decisions, constraints, relationships, and their
|
|
8
|
+
rationale. Source repositories still own implementation detail, task history,
|
|
9
|
+
and credentials.
|
|
13
10
|
|
|
14
|
-
##
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- Node.js 22.13 or newer
|
|
14
|
+
- Git
|
|
15
|
+
- GitHub CLI (`gh`) only for connecting a GitHub tree or publishing
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
Git and GitHub authentication remain owned by the host tools. Repository inputs
|
|
18
|
+
are credential-free `OWNER/REPO` identities, never URLs containing credentials.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
18
21
|
|
|
19
22
|
### Codex or Claude Code plugin (recommended)
|
|
20
23
|
|
|
@@ -35,145 +38,175 @@ claude plugin marketplace add first-tree-ai/context-tree
|
|
|
35
38
|
claude plugin install context-tree@context-tree
|
|
36
39
|
```
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
The plugin uses its own packaged CLI, so plugin users do not need a global CLI
|
|
44
|
-
installation. Try asking:
|
|
41
|
+
Both marketplaces install the same npm package, and every plugin component uses
|
|
42
|
+
its private packaged CLI rather than a global `PATH` command — so plugin users
|
|
43
|
+
need no separate CLI installation. Review and trust the session-start hook if
|
|
44
|
+
your host asks. Then try asking:
|
|
45
45
|
|
|
46
|
-
>
|
|
46
|
+
> Set up a Context Tree for this project, then read the relevant context.
|
|
47
47
|
|
|
48
|
-
>
|
|
48
|
+
> Write this architectural decision to the Context Tree.
|
|
49
49
|
|
|
50
50
|
### Global CLI (optional)
|
|
51
51
|
|
|
52
|
-
Install
|
|
53
|
-
|
|
52
|
+
Install globally only when scripts or terminal workflows need a `context-tree`
|
|
53
|
+
command on `PATH`:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
npm install --global @first-tree-ai/context-tree
|
|
57
57
|
context-tree --help
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Six skills
|
|
61
|
+
|
|
62
|
+
### Setup
|
|
63
|
+
|
|
64
|
+
`context-tree-setup` orchestrates lifecycle setup for projects with no
|
|
65
|
+
connection. It asks whether to create a new tree or connect an existing one,
|
|
66
|
+
then delegates to the create or connect workflow rather than duplicating
|
|
67
|
+
lifecycle policy. Read and write invoke setup when the current project has no
|
|
68
|
+
connection, and the session hook remains silent. Setup never publishes without
|
|
69
|
+
explicit confirmation.
|
|
70
|
+
|
|
71
|
+
### Create
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
context-tree create --project-path ./service
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`create` derives `<normalized-project-directory>-context-tree`, scaffolds and
|
|
78
|
+
commits it under `~/.context-tree/trees`, then connects it atomically. It is
|
|
79
|
+
idempotent only while the project remains connected to that managed tree.
|
|
80
|
+
|
|
81
|
+
### Connect
|
|
82
|
+
|
|
83
|
+
Connect to an existing managed tree by exact name:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
context-tree connect shared-context-tree --project-path ./service
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Or reuse or clone a GitHub tree by repository identity:
|
|
61
90
|
|
|
62
|
-
|
|
91
|
+
```bash
|
|
92
|
+
context-tree connect OWNER/REPO --project-path ./service
|
|
93
|
+
```
|
|
63
94
|
|
|
64
|
-
|
|
95
|
+
Or connect an existing checkout in place by exact disk path:
|
|
65
96
|
|
|
66
97
|
```bash
|
|
67
|
-
context-tree
|
|
98
|
+
context-tree connect --tree-path /path/to/a/tree --project-path ./service
|
|
68
99
|
```
|
|
69
100
|
|
|
70
|
-
|
|
101
|
+
`connect --tree-path` requires an exact, clean, fully valid Git root with no
|
|
102
|
+
symlink components. Trees without an origin connect as local state;
|
|
103
|
+
credential-free GitHub origins connect as GitHub state. External disk trees
|
|
104
|
+
are never copied, moved, or deleted.
|
|
105
|
+
|
|
106
|
+
An identical connection is idempotent. An explicit connect automatically
|
|
107
|
+
switches the project. GitHub checkouts use the repository's lowercase name in
|
|
108
|
+
the same flat managed namespace as created trees.
|
|
109
|
+
|
|
110
|
+
`context-tree list` reports valid, clean managed trees as
|
|
111
|
+
`{ schemaVersion: 1, trees: [{ name, tree }] }`; a missing managed directory
|
|
112
|
+
is an empty list.
|
|
113
|
+
|
|
114
|
+
### Read
|
|
71
115
|
|
|
72
116
|
```bash
|
|
73
|
-
context-tree
|
|
117
|
+
context-tree sync --project-path ./service
|
|
118
|
+
context-tree read product/runtime.md --tree-path /path/from/sync
|
|
74
119
|
```
|
|
75
120
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
validation workflow pinned to the package version and selected initial branch.
|
|
80
|
-
The init skill, rather than the CLI, owns the initial commit and any publication.
|
|
121
|
+
Local trees report their checked-out branch and exact `HEAD` without network
|
|
122
|
+
access. GitHub trees perform one fast-forward-only pull of the checked-out
|
|
123
|
+
branch. Reads navigate from indexes to narrow, task-relevant children.
|
|
81
124
|
|
|
82
|
-
###
|
|
125
|
+
### Write
|
|
83
126
|
|
|
84
127
|
```bash
|
|
85
|
-
context-tree
|
|
86
|
-
|
|
87
|
-
context-tree
|
|
88
|
-
|
|
89
|
-
|
|
128
|
+
context-tree prepare-write --project-path ./service
|
|
129
|
+
# Edit only the returned worktreePath.
|
|
130
|
+
context-tree finish-write --project-path ./service \
|
|
131
|
+
--worktree-path /path/from/prepare \
|
|
132
|
+
--message "Record runtime constraint"
|
|
90
133
|
```
|
|
91
134
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
fast-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
135
|
+
Preparation synchronizes first and creates a random isolated worktree at that
|
|
136
|
+
exact commit. Finishing validates the worktree, stages every pending change,
|
|
137
|
+
creates one unsigned commit using the host identity, and attempts one
|
|
138
|
+
fast-forward merge for local trees or one non-force push for GitHub trees.
|
|
139
|
+
|
|
140
|
+
If the destination advanced, `finish-write` returns `WRITE_OUTDATED` and
|
|
141
|
+
preserves the worktree. Prepare again and reapply the intended semantic change
|
|
142
|
+
once; there is no automatic rebase, retry loop, or pull-request fallback.
|
|
99
143
|
|
|
100
|
-
|
|
101
|
-
|
|
144
|
+
A preserved or abandoned write leaves its temporary worktree on disk and a
|
|
145
|
+
`context-tree/write/<name>` branch in the tree. Nothing removes these for you:
|
|
146
|
+
clear them with `git worktree remove <path>` and `git branch -D <branch>` in the
|
|
147
|
+
connected tree once you no longer need the pending edits.
|
|
102
148
|
|
|
103
|
-
###
|
|
149
|
+
### Publish
|
|
104
150
|
|
|
105
151
|
```bash
|
|
106
|
-
context-tree
|
|
107
|
-
context-tree
|
|
152
|
+
context-tree publish --project-path ./service
|
|
153
|
+
# or: context-tree publish OWNER/REPO --project-path ./service
|
|
108
154
|
```
|
|
109
155
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
156
|
+
Publishing requires a clean, valid local tree with no `origin`. It creates one
|
|
157
|
+
new private GitHub repository, pushes the checkout, and then changes the stored
|
|
158
|
+
connection to GitHub state. Those external and local changes are not atomic;
|
|
159
|
+
uncertain or partial outcomes are reported as `PUBLISH_INCOMPLETE` and are not
|
|
160
|
+
automatically inspected or repaired.
|
|
161
|
+
|
|
162
|
+
## Project identity
|
|
163
|
+
|
|
164
|
+
Git project paths resolve to the exact root of that checkout. A clone or Git
|
|
165
|
+
worktree is independent even if it shares an origin or Git common directory.
|
|
166
|
+
Non-Git projects match only the exact connected directory; nested directories
|
|
167
|
+
do not inherit the connection.
|
|
168
|
+
|
|
169
|
+
Connection data is written atomically with mode `0600` at
|
|
170
|
+
`~/.context-tree/connections.json`. Duplicate project records are corruption.
|
|
171
|
+
Stored local/GitHub state is not reclassified from mutable remotes.
|
|
172
|
+
|
|
173
|
+
Every command that touches a connected tree reports why it refused:
|
|
174
|
+
`NO_CONNECTION` (nothing connected), `DIRTY_TREE` (your uncommitted edits —
|
|
175
|
+
commit or discard them), `INVALID_TREE` (structure fails `verify`),
|
|
176
|
+
`STALE_CONNECTION` (the stored path is gone; connect again), and
|
|
177
|
+
`CORRUPT_CONNECTION` (unreadable or duplicated records).
|
|
178
|
+
|
|
179
|
+
## CLI plumbing
|
|
180
|
+
|
|
181
|
+
The public command inventory is:
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
create connect list resolve sync prepare-write finish-write
|
|
185
|
+
publish read verify policy
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Setup, create, connect, read, write, and publish ship as six skills; setup
|
|
189
|
+
orchestrates the five concrete workflows. `resolve`, `sync`, `prepare-write`,
|
|
190
|
+
`finish-write`, `verify`, and `policy` are plugin plumbing or diagnostic
|
|
191
|
+
commands rather than separate user intentions; `list` backs setup's
|
|
192
|
+
connect-target discovery.
|
|
193
|
+
All machine-readable responses use strict schema version `1`.
|
|
194
|
+
|
|
195
|
+
`verify` is intended for CI and diagnostics. Normal skills invoke it only after
|
|
196
|
+
an operation reports invalid tree content.
|
|
115
197
|
|
|
116
|
-
|
|
198
|
+
## Development
|
|
117
199
|
|
|
118
200
|
```bash
|
|
119
|
-
|
|
201
|
+
pnpm install
|
|
202
|
+
pnpm check
|
|
203
|
+
pnpm typecheck
|
|
204
|
+
pnpm test
|
|
205
|
+
pnpm build
|
|
206
|
+
pnpm validate:skills
|
|
207
|
+
pnpm check:package
|
|
208
|
+
npm pack --dry-run
|
|
120
209
|
```
|
|
121
210
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## Command reference
|
|
125
|
-
|
|
126
|
-
| Command | Purpose | Essential arguments and options |
|
|
127
|
-
| --- | --- | --- |
|
|
128
|
-
| `link` | Link a project to a verified checkout | `--project-path <path>`, `--tree-path <path>` |
|
|
129
|
-
| `resolve` | Resolve a project's recorded link | `--project-path <path>` (default `.`) |
|
|
130
|
-
| `refresh` | Fast-forward a linked tree to its live default branch | `--project-path <path>` (default `.`) |
|
|
131
|
-
| `stage` | Prepare an isolated worktree for a write | `--project-path <path>` (default `.`) |
|
|
132
|
-
| `diff` | Inspect changes in a prepared worktree | `[tree-path]` (default `.`), `--base <ref>` (default `HEAD`) |
|
|
133
|
-
| `init` | Scaffold a new tree | `--repository <owner/repo>`, optional `--tree-path <path>` |
|
|
134
|
-
| `policy` | Print the packaged Context Tree policy | None |
|
|
135
|
-
| `read` | Read a node or Markdown leaf | `[path]` (default `.`), `--tree-path <path>` (default `.`) |
|
|
136
|
-
| `verify` | Validate tree structure and safety | `--tree-path <path>` (default `.`) |
|
|
137
|
-
|
|
138
|
-
Successful commands and runtime or argument failures emit one
|
|
139
|
-
`schemaVersion: 1` JSON object on stdout. Help and version output are plain
|
|
140
|
-
text. An invalid `verify` report is still emitted and exits with status 1. The
|
|
141
|
-
strict Zod schemas are the source of truth for public wire contracts.
|
|
142
|
-
|
|
143
|
-
Links are machine-local internal state in
|
|
144
|
-
`~/.context-tree/connections.json`; do not edit this file manually. Managed
|
|
145
|
-
clones default to `~/.context-tree/checkouts/OWNER/REPO`. Resolution does not
|
|
146
|
-
search for moved checkouts, so use the link skill again to repair a stale link.
|
|
147
|
-
|
|
148
|
-
## Safety and lifecycle
|
|
149
|
-
|
|
150
|
-
- **Credentials:** The core and CLI neither manage credentials nor perform
|
|
151
|
-
authenticated GitHub operations. Repository URLs containing credentials are
|
|
152
|
-
rejected and never logged; host Git and GitHub CLI own authentication.
|
|
153
|
-
- **Checkout validation:** Linking requires a clean, exact Git root with a safe
|
|
154
|
-
GitHub origin and a fully valid tree. Resolution fails closed for symlinks,
|
|
155
|
-
moved paths, dirty trees, origin mismatches, and invalid roots. `init` has a
|
|
156
|
-
narrow exception for its four new uncommitted scaffold files.
|
|
157
|
-
- **Git operations:** Reads fast-forward only. Writes start from a freshly
|
|
158
|
-
fetched default-branch commit in an isolated worktree and never force-push.
|
|
159
|
-
Commit SHAs identify shared snapshots.
|
|
160
|
-
- **Hooks:** Session and subagent hooks inject only a resolved tree identity and
|
|
161
|
-
path. They are silent when no link matches and never fetch, clone, or mutate.
|
|
162
|
-
They use only the plugin's packaged CLI and warn if it is unavailable.
|
|
163
|
-
- **Write fallback:** The write skill retries bounded concurrent updates. If a
|
|
164
|
-
direct push is denied or retries are exhausted, it opens a conflict-free PR
|
|
165
|
-
from the latest default branch without merging it or requesting reviewers.
|
|
166
|
-
Each write and commit is scoped to one concrete source.
|
|
167
|
-
|
|
168
|
-
For tree structure, link replacement rules, validation boundaries, memory
|
|
169
|
-
selection, read/write lifecycle details, and exact public contracts, see the
|
|
170
|
-
[Context Tree format specification](docs/specification.md).
|
|
171
|
-
|
|
172
|
-
## Compatibility
|
|
173
|
-
|
|
174
|
-
The package uses `.codex-plugin/plugin.json` and `.claude-plugin/plugin.json` as
|
|
175
|
-
host adapters for installation and lifecycle integration. It intentionally
|
|
176
|
-
omits a root `plugin.json`: Codex 0.151.0 treats that portable manifest as an
|
|
177
|
-
alternate plugin shape and fails to discover bundled lifecycle hooks. Both
|
|
178
|
-
marketplaces install the same npm package, and all plugin components use its
|
|
179
|
-
private packaged CLI at the same version rather than a global `PATH` command.
|
|
211
|
+
See [docs/specification.md](docs/specification.md) for contracts and safety
|
|
212
|
+
invariants.
|