@first-tree-ai/context-tree 0.1.1 → 0.1.3-alpha.202608310358

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.
@@ -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,16 @@
1
+ {
2
+ "name": "context-tree",
3
+ "version": "0.1.3-alpha.202608310358",
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": [
12
+ "context-tree",
13
+ "memory",
14
+ "agents"
15
+ ]
16
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "context-tree",
3
+ "version": "0.1.3-alpha.202608310358",
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": [
13
+ "context-tree",
14
+ "memory",
15
+ "agents"
16
+ ],
17
+ "skills": "./skills/",
18
+ "interface": {
19
+ "displayName": "Context Tree",
20
+ "shortDescription": "Resolve and use durable project context",
21
+ "longDescription": "Link projects to verified Context Tree checkouts, then resolve, read, and publish durable context without persisting branches or credentials.",
22
+ "developerName": "First Tree AI",
23
+ "category": "Developer Tools",
24
+ "capabilities": [
25
+ "Read",
26
+ "Write"
27
+ ],
28
+ "websiteURL": "https://github.com/first-tree-ai/context-tree",
29
+ "defaultPrompt": [
30
+ "Link this project to its Context Tree.",
31
+ "Read the relevant Context Tree context.",
32
+ "Publish this durable decision to the Context Tree."
33
+ ]
34
+ }
35
+ }
package/README.md CHANGED
@@ -1,105 +1,178 @@
1
1
  # Context Tree
2
2
 
3
- `@first-tree-ai/context-tree` is the portable core for a GitHub-backed Context
4
- Tree: durable decisions, constraints, and cross-domain relationships
5
- stored as Markdown in a private GitHub repository. It ships deterministic local
6
- scaffolding, validation, indexed reading, the canonical policy, Zod contracts,
7
- and framework-neutral agent skills.
8
-
9
- The core and CLI never make network requests or manage credentials. Init takes
10
- an explicit GitHub `OWNER/REPO`. Read and write instead take an existing local
11
- checkout whose exact path authorizes only that checkout and its verified,
12
- credential-free GitHub `origin`. GitHub Enterprise Server and other forges are
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
- pnpm add @first-tree-ai/context-tree
19
- pnpm exec context-tree --help
27
+ codex plugin marketplace add first-tree-ai/context-tree
28
+ codex plugin add context-tree@context-tree
20
29
  ```
21
30
 
22
- Or install the CLI globally:
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
- Bundled skills can be installed with the Agent Skills CLI:
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
- npx skills add first-tree-ai/context-tree --list
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
- ## CLI
70
+ Or link a project to an existing, verified checkout:
36
71
 
37
- The CLI exposes exactly four commands: `init`, `policy`, `read`, and `verify`.
38
- Successful command results and runtime or argument failures emit one versioned
39
- JSON object on stdout. Help and version output remain plain text.
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 init \
43
- --repository acme/context \
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
- When `--tree-path` is omitted, init writes to `./REPO` and uses the `REPO`
52
- segment verbatim as the tree title. Scaffolding is create-only and always
53
- includes GitHub Actions validation pinned to the package version that created
54
- the tree and filtered to the branch selected by ordinary `git init`. Init
55
- requires Git and respects Git's effective `init.defaultBranch` configuration or
56
- its compiled fallback. The CLI and library perform no GitHub or credential
57
- operations. The init skill uses the CLI-created repository and current branch
58
- for its local commit and, when GitHub CLI is authenticated, private-repository
59
- publication and default-branch configuration.
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
- Git commit SHAs identify shared snapshots. Read nodes, child summaries, read results,
104
- verification reports, and policy results intentionally contain no hashes or
105
- digest fields. See [the format specification](docs/specification.md).
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.