@first-tree-ai/context-tree 0.1.1 → 0.1.2
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/.agents/plugins/marketplace.json +19 -0
- package/.claude-plugin/marketplace.json +21 -0
- package/.claude-plugin/plugin.json +12 -0
- package/.codex-plugin/plugin.json +28 -0
- package/README.md +152 -79
- package/dist/cli/index.mjs +25841 -6
- package/dist/index.d.mts +11 -2
- package/dist/index.mjs +1087 -2
- package/dist/{schemas-DyQ0V9Z3.mjs → schemas-BWM6Q6iz.mjs} +75 -6
- package/dist/{schemas-BZkU14CI.d.mts → schemas-C4bs-FkC.d.mts} +115 -3
- package/dist/schemas.d.mts +2 -2
- package/dist/schemas.mjs +2 -2
- package/docs/specification.md +58 -23
- package/examples/basic/NODE.md +0 -2
- package/hooks/hooks.json +26 -0
- package/hooks/session-start.mjs +64 -0
- package/package.json +10 -4
- package/plugin.json +14 -0
- package/policy/context-tree-policy.md +2 -0
- package/skills/context-tree-init/SKILL.md +11 -10
- package/skills/context-tree-init/scripts/context-tree.mjs +41 -0
- package/skills/context-tree-link/SKILL.md +45 -0
- package/skills/context-tree-link/agents/openai.yaml +4 -0
- package/skills/context-tree-link/scripts/context-tree.mjs +41 -0
- package/skills/context-tree-read/SKILL.md +27 -25
- package/skills/context-tree-read/agents/openai.yaml +1 -1
- package/skills/context-tree-read/scripts/context-tree.mjs +41 -0
- package/skills/context-tree-write/SKILL.md +53 -35
- package/skills/context-tree-write/agents/openai.yaml +1 -1
- package/skills/context-tree-write/scripts/context-tree.mjs +41 -0
- package/templates/AGENTS.md +66 -0
- package/dist/src-DJZoQVCF.mjs +0 -619
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "context-tree",
|
|
3
|
+
"interface": { "displayName": "Context Tree" },
|
|
4
|
+
"plugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "context-tree",
|
|
7
|
+
"source": {
|
|
8
|
+
"source": "npm",
|
|
9
|
+
"package": "@first-tree-ai/context-tree",
|
|
10
|
+
"version": "latest"
|
|
11
|
+
},
|
|
12
|
+
"policy": {
|
|
13
|
+
"installation": "AVAILABLE",
|
|
14
|
+
"authentication": "ON_INSTALL"
|
|
15
|
+
},
|
|
16
|
+
"category": "Developer Tools"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "context-tree",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "First Tree AI",
|
|
5
|
+
"url": "https://github.com/first-tree-ai"
|
|
6
|
+
},
|
|
7
|
+
"metadata": {
|
|
8
|
+
"description": "Install the complete Context Tree plugin for linked, durable project context."
|
|
9
|
+
},
|
|
10
|
+
"plugins": [
|
|
11
|
+
{
|
|
12
|
+
"name": "context-tree",
|
|
13
|
+
"description": "Complete Context Tree plugin for linking, reading, and publishing durable project context.",
|
|
14
|
+
"source": {
|
|
15
|
+
"source": "npm",
|
|
16
|
+
"package": "@first-tree-ai/context-tree",
|
|
17
|
+
"version": "latest"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "context-tree",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Complete Context Tree plugin with linking, reading, durable writes, and a packaged CLI.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "First Tree AI"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/first-tree-ai/context-tree",
|
|
9
|
+
"repository": "https://github.com/first-tree-ai/context-tree",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"keywords": ["context-tree", "memory", "agents"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "context-tree",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Complete Context Tree plugin with linking, reading, durable writes, and a packaged CLI.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "First Tree AI",
|
|
7
|
+
"url": "https://github.com/first-tree-ai"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/first-tree-ai/context-tree",
|
|
10
|
+
"repository": "https://github.com/first-tree-ai/context-tree",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"keywords": ["context-tree", "memory", "agents"],
|
|
13
|
+
"skills": "./skills/",
|
|
14
|
+
"interface": {
|
|
15
|
+
"displayName": "Context Tree",
|
|
16
|
+
"shortDescription": "Resolve and use durable project context",
|
|
17
|
+
"longDescription": "Link projects to verified Context Tree checkouts, then resolve, read, and publish durable context without persisting branches or credentials.",
|
|
18
|
+
"developerName": "First Tree AI",
|
|
19
|
+
"category": "Developer Tools",
|
|
20
|
+
"capabilities": ["Read", "Write"],
|
|
21
|
+
"websiteURL": "https://github.com/first-tree-ai/context-tree",
|
|
22
|
+
"defaultPrompt": [
|
|
23
|
+
"Link this project to its Context Tree.",
|
|
24
|
+
"Read the relevant Context Tree context.",
|
|
25
|
+
"Publish this durable decision to the Context Tree."
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
package/README.md
CHANGED
|
@@ -1,105 +1,178 @@
|
|
|
1
1
|
# Context Tree
|
|
2
2
|
|
|
3
|
-
`@first-tree-ai/context-tree`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
unsupported.
|
|
3
|
+
`@first-tree-ai/context-tree` gives agents durable project context: decisions,
|
|
4
|
+
constraints, and relationships stored as Markdown in a private GitHub
|
|
5
|
+
repository. It supports Codex and Claude Code through a portable Agent Plugins
|
|
6
|
+
v1 package and includes a CLI for shell automation.
|
|
7
|
+
|
|
8
|
+
Each project is explicitly linked to a verified local checkout. Future sessions
|
|
9
|
+
resolve that checkout from the project's credential-free Git origin, or from its
|
|
10
|
+
real directory when the project is not a Git repository. Context Tree currently
|
|
11
|
+
supports repositories on GitHub.com only; GitHub Enterprise Server and other
|
|
12
|
+
forges are not supported.
|
|
14
13
|
|
|
15
14
|
## Install
|
|
16
15
|
|
|
16
|
+
Node.js 22.13 or newer and npm are required. Git is also required to initialize
|
|
17
|
+
trees and use Git-backed workflows.
|
|
18
|
+
|
|
19
|
+
### Codex or Claude Code plugin (recommended)
|
|
20
|
+
|
|
21
|
+
Install the marketplace and plugin, then start a new session so the host can
|
|
22
|
+
discover the skills and lifecycle hook.
|
|
23
|
+
|
|
24
|
+
For Codex:
|
|
25
|
+
|
|
17
26
|
```bash
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
codex plugin marketplace add first-tree-ai/context-tree
|
|
28
|
+
codex plugin add context-tree@context-tree
|
|
20
29
|
```
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
For Claude Code:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
claude plugin marketplace add first-tree-ai/context-tree
|
|
35
|
+
claude plugin install context-tree@context-tree
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Marketplace installation requires repository access to
|
|
39
|
+
`first-tree-ai/context-tree`. These selectors resolve the npm `latest` package,
|
|
40
|
+
which must contain the plugin manifests, hook, four skills and launchers, and
|
|
41
|
+
`dist/cli/index.mjs`. Review and trust the session-start hook if your host asks.
|
|
42
|
+
|
|
43
|
+
The plugin uses its own packaged CLI, so plugin users do not need a global CLI
|
|
44
|
+
installation. Try asking:
|
|
45
|
+
|
|
46
|
+
> Link this project to my Context Tree, then read the relevant context.
|
|
47
|
+
|
|
48
|
+
> Publish this architectural decision to the Context Tree.
|
|
49
|
+
|
|
50
|
+
### Global CLI (optional)
|
|
51
|
+
|
|
52
|
+
Install the package globally only when scripts or terminal workflows need a
|
|
53
|
+
`context-tree` command on `PATH`:
|
|
23
54
|
|
|
24
55
|
```bash
|
|
25
56
|
npm install --global @first-tree-ai/context-tree
|
|
57
|
+
context-tree --help
|
|
26
58
|
```
|
|
27
59
|
|
|
28
|
-
|
|
60
|
+
## CLI workflows
|
|
61
|
+
|
|
62
|
+
### Initialize or link a tree
|
|
63
|
+
|
|
64
|
+
Create a new tree and record a local link for the current project:
|
|
29
65
|
|
|
30
66
|
```bash
|
|
31
|
-
|
|
32
|
-
npx skills add first-tree-ai/context-tree --skill context-tree-read
|
|
67
|
+
context-tree init --repository acme/context --tree-path ./context-tree
|
|
33
68
|
```
|
|
34
69
|
|
|
35
|
-
|
|
70
|
+
Or link a project to an existing, verified checkout:
|
|
36
71
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
72
|
+
```bash
|
|
73
|
+
context-tree link --project-path ./service --tree-path ./context-tree
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If `init` omits `--tree-path`, it creates `./REPO`, using the repository name
|
|
77
|
+
verbatim as the directory and tree title. Scaffolding is create-only. It runs
|
|
78
|
+
ordinary `git init`, configures a credential-free GitHub origin, and creates a
|
|
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.
|
|
81
|
+
|
|
82
|
+
### Resolve, refresh, read, and verify
|
|
40
83
|
|
|
41
84
|
```bash
|
|
42
|
-
context-tree
|
|
43
|
-
|
|
44
|
-
--tree-path ./context-tree
|
|
45
|
-
context-tree policy
|
|
46
|
-
context-tree verify --tree-path ./context-tree
|
|
85
|
+
context-tree resolve --project-path ./service
|
|
86
|
+
context-tree refresh --project-path ./service
|
|
47
87
|
context-tree read --tree-path ./context-tree
|
|
48
88
|
context-tree read product --tree-path ./context-tree
|
|
89
|
+
context-tree verify --tree-path ./context-tree
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`resolve` checks the recorded checkout, origin, cleanliness, and root
|
|
93
|
+
`NODE.md`; it does not scan the whole semantic tree. `refresh` discovers the
|
|
94
|
+
live default branch, requires it to match the checked-out branch, and
|
|
95
|
+
fast-forwards before reads. Agent reads refresh and fully verify the tree, then
|
|
96
|
+
report the exact commit SHA. If GitHub is unavailable, a stale read requires
|
|
97
|
+
explicit authorization, is clearly labeled, and can never be used as a write
|
|
98
|
+
base.
|
|
99
|
+
|
|
100
|
+
Directory reads return the selected `NODE.md` body and metadata plus summaries
|
|
101
|
+
of immediate children. Leaf reads return the leaf body without children.
|
|
102
|
+
|
|
103
|
+
### Prepare and inspect a write
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
context-tree stage --project-path ./service
|
|
107
|
+
context-tree diff ./prepared-worktree --base HEAD
|
|
49
108
|
```
|
|
50
109
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Directory reads return that directory's `NODE.md` body and metadata plus
|
|
62
|
-
summaries of its immediate children. Leaf reads return the leaf body and no
|
|
63
|
-
children. Member classification is semantic metadata, not core access control.
|
|
64
|
-
The read skill fast-forward refreshes an explicitly
|
|
65
|
-
supplied existing checkout, requires it to be clean and on the expected branch,
|
|
66
|
-
derives `OWNER/REPO` from its safe GitHub origin, and reports the exact Git
|
|
67
|
-
commit SHA. If GitHub is unavailable, a stale read requires explicit
|
|
68
|
-
authorization and is clearly labeled; stale state can never become the base for
|
|
69
|
-
a write.
|
|
70
|
-
|
|
71
|
-
Writes are normal file edits performed by the write skill, not a CLI command.
|
|
72
|
-
Every write receives one concrete source through the authorized task context,
|
|
73
|
-
accepts an authoritative `default_branch`, freshly fetches that branch through
|
|
74
|
-
a supplied fetch-only checkout, creates an isolated worktree at its exact
|
|
75
|
-
commit, verifies the base, edits only necessary Markdown, verifies again,
|
|
76
|
-
inspects the complete diff, commits, and non-force pushes directly to the
|
|
77
|
-
supplied default branch. Concurrent updates are rebased and verified locally
|
|
78
|
-
with bounded retries. If direct publication is denied or the retry limit is
|
|
79
|
-
exhausted, the skill rebases against the latest default branch and opens a
|
|
80
|
-
conflict-free fallback PR without merging it or requesting reviewers. An
|
|
81
|
-
invalid base blocks semantic changes; an explicit repair request may produce a
|
|
82
|
-
repair-only write and commit limited to validator findings. Each write and
|
|
83
|
-
commit is scoped to one concrete source. Read and write use `agent_slug` solely
|
|
84
|
-
to select optional private memory at `members/<agent_slug>/memory.md`.
|
|
85
|
-
|
|
86
|
-
## Library integration
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
import { readContextTreePolicy, readTree, scaffoldTree, verifyTree } from "@first-tree-ai/context-tree";
|
|
90
|
-
import { contextTreeReadResultSchema, verifyTreeReportSchema } from "@first-tree-ai/context-tree/schemas";
|
|
91
|
-
|
|
92
|
-
scaffoldTree({
|
|
93
|
-
path: "./context-tree",
|
|
94
|
-
repository: "acme/context",
|
|
95
|
-
});
|
|
96
|
-
const verification = verifyTree("./context-tree");
|
|
97
|
-
const relevant = readTree("./context-tree", "systems");
|
|
98
|
-
|
|
99
|
-
verifyTreeReportSchema.parse(verification);
|
|
100
|
-
contextTreeReadResultSchema.parse(relevant);
|
|
110
|
+
`stage` fetches the live default branch and creates an isolated worktree at its
|
|
111
|
+
exact commit. After edits, `diff` reports all pending changes against the given
|
|
112
|
+
base (`HEAD` by default). These are preparation and inspection commands: there
|
|
113
|
+
is no CLI publish command. The write skill edits, verifies, reviews, commits,
|
|
114
|
+
rebases when necessary, and publishes the result.
|
|
115
|
+
|
|
116
|
+
### Retrieve the policy
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
context-tree policy
|
|
101
120
|
```
|
|
102
121
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
This returns the canonical policy packaged with the installed version.
|
|
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 root `plugin.json` is the portable Agent Plugins v1 manifest, and compatible
|
|
175
|
+
hosts discover the four skills from `skills/`. The Codex and Claude manifests
|
|
176
|
+
are current-client adapters for installation and lifecycle integration. Both
|
|
177
|
+
marketplaces install the same npm package, and all plugin components use its
|
|
178
|
+
private packaged CLI at the same version rather than a global `PATH` command.
|