threadroot 0.1.0

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +261 -0
  4. package/SECURITY.md +22 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +4341 -0
  7. package/package.json +81 -0
  8. package/packs/code-review/pack.yaml +7 -0
  9. package/packs/python/pack.yaml +10 -0
  10. package/packs/react-app/pack.yaml +10 -0
  11. package/packs/security-review/pack.yaml +7 -0
  12. package/packs/system-design/pack.yaml +5 -0
  13. package/packs/testing/pack.yaml +7 -0
  14. package/packs/typescript-node/pack.yaml +9 -0
  15. package/skills/README.md +39 -0
  16. package/skills/add-test/SKILL.md +20 -0
  17. package/skills/add-test/evals/triggers.json +12 -0
  18. package/skills/build-skill/SKILL.md +36 -0
  19. package/skills/build-skill/evals/triggers.json +16 -0
  20. package/skills/build-skill/references/eval-prompts.md +20 -0
  21. package/skills/build-skill/references/skill-quality.md +18 -0
  22. package/skills/build-tool/SKILL.md +35 -0
  23. package/skills/build-tool/evals/triggers.json +13 -0
  24. package/skills/catalog.json +50 -0
  25. package/skills/code-review/SKILL.md +24 -0
  26. package/skills/code-review/evals/triggers.json +12 -0
  27. package/skills/conventional-commits/SKILL.md +29 -0
  28. package/skills/conventional-commits/evals/triggers.json +12 -0
  29. package/skills/debug-failure/SKILL.md +21 -0
  30. package/skills/debug-failure/evals/triggers.json +12 -0
  31. package/skills/security-review/SKILL.md +24 -0
  32. package/skills/security-review/evals/triggers.json +12 -0
  33. package/skills/system-design/SKILL.md +33 -0
  34. package/skills/system-design/evals/triggers.json +17 -0
  35. package/skills/system-design/references/api-data-design.md +15 -0
  36. package/skills/system-design/references/architecture-checklist.md +26 -0
  37. package/skills/system-design/references/reliability-observability.md +17 -0
  38. package/skills/write-docs/SKILL.md +20 -0
  39. package/skills/write-docs/evals/triggers.json +12 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to Threadroot will be documented here.
4
+
5
+ Threadroot follows semantic versioning after the first public release. While `0.x`, minor versions may include breaking changes as the harness format settles.
6
+
7
+ ## 0.1.0 - Initial OSS alpha
8
+
9
+ ### Added
10
+
11
+ - Local-first Threadroot CLI with `threadroot` and `tr` binaries.
12
+ - Repo harness initialization through `.threadroot/harness.yaml`.
13
+ - Adapter compilation for AGENTS.md, Claude, Copilot, and Cursor.
14
+ - Durable memory, rules, skills, tools, connections, and capability packs.
15
+ - MCP server exposing context, skills, tools, connections, memory, status, and doctor tools.
16
+ - Curated starter skills and v1 capability packs.
17
+ - Tool risk, confirmation, healthcheck, and connection-aware execution.
18
+ - `threadroot doctor` for harness health, drift, trust, MCP hints, and connection checks.
19
+ - npm package release checks and packed-package smoke test.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sevan Lewis-Payne
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,261 @@
1
+ # Threadroot
2
+
3
+ Threadroot is **git for your AI agent harness**: you author skills, rules, tools, and
4
+ memory once in a canonical `.threadroot/` directory, and Threadroot compiles them into
5
+ every vendor format (AGENTS.md, Claude, Copilot, Cursor) so your agents stay in sync.
6
+
7
+ It is local-first: a `tr` CLI for humans and CI, plus a local MCP server that exposes the
8
+ same harness to coding agents. V1 does not require a cloud account, API key, or hosted
9
+ service.
10
+
11
+ ## Install
12
+
13
+ Run Threadroot without adding it to your project:
14
+
15
+ ```bash
16
+ pnpm dlx threadroot init
17
+ # or
18
+ npx threadroot init
19
+ # or, explicitly with npm exec
20
+ npm exec --package=threadroot -- threadroot init
21
+ ```
22
+
23
+ After initialization:
24
+
25
+ ```bash
26
+ threadroot doctor
27
+ threadroot context "write tests"
28
+ threadroot mcp setup --write
29
+ ```
30
+
31
+ For local development on Threadroot itself:
32
+
33
+ ```bash
34
+ pnpm install
35
+ pnpm build
36
+ node dist/index.js --help
37
+ ```
38
+
39
+ ## Quick start
40
+
41
+ ```bash
42
+ tr init # detect the repo, scaffold a harness, import existing
43
+ # vendor files once, and compile
44
+ tr status # authored objects vs compiled outputs, with drift
45
+ tr context "write tests" # task-relevant skills, rules, tools, and memory
46
+ tr doctor # health check for harness validity, drift, MCP hints, tool trust
47
+ tr diff # line diff between canonical sources and vendor files
48
+ ```
49
+
50
+ `threadroot` is the full name; `tr` is the short alias.
51
+
52
+ ## CLI surface
53
+
54
+ ```bash
55
+ tr init [--force] [--no-import] [--profile <p>] [--adapters <list>]
56
+ tr status
57
+ tr diff
58
+ tr doctor
59
+ tr compile [--adapter <agents|claude|copilot|cursor>]
60
+ tr context "<task>" # assemble the task-relevant harness slice
61
+ tr run <tool> [--input k=v ...] [-y]
62
+ tr install <source> [--kind skill|tool|rule|connection] [--path <p>] [--user]
63
+ tr remember "<note>" [--type project|current-focus|handoff|pitfalls]
64
+ tr memory read <type>
65
+ tr memory append <type> "<note>"
66
+ tr skills list | validate [--path <path>]
67
+ tr skills inspect <path>
68
+ tr tools list | detect | check
69
+ tr tools add <name> --description "<text>" [--run "<cmd>"]
70
+ tr tools create --from-command "<cmd>"
71
+ tr connections list | check
72
+ tr connections add <name> --provider <p> --command <cmd>
73
+ tr packs list | inspect <pack> | validate <pack> | install <pack>
74
+ tr mcp # run the local MCP server (stdio)
75
+ tr mcp setup [--write] # wire MCP into agents
76
+ ```
77
+
78
+ ## The harness (`.threadroot/`)
79
+
80
+ The canonical, vendor-neutral source of truth:
81
+
82
+ ```
83
+ .threadroot/
84
+ harness.yaml # manifest: name, profile, adapters, tools.allow
85
+ skills/<name>/SKILL.md # modern folder skills with optional references/scripts/assets
86
+ skills/*.md # legacy/simple single-file skills are still supported
87
+ rules/*.md # always-on rules (optional applyTo glob)
88
+ tools/*.yaml # executable tool manifests (allow-listed)
89
+ connections/*.yaml # local CLI bridges used by connection-aware tools
90
+ memory/*.md # durable, typed project memory
91
+ lock.json # provenance for installed objects (commit SHA + integrity)
92
+ ```
93
+
94
+ `tr compile` turns the harness into the big-four vendor formats. Hand-authored prose in a
95
+ vendor file is preserved; Threadroot only owns the block it marks as generated.
96
+
97
+ ## Built-in content
98
+
99
+ `tr init` seeds a useful harness on an empty repo:
100
+
101
+ - **Starter skills:** system-design, build-skill, build-tool, code-review, security-review,
102
+ add-test, debug-failure, write-docs, conventional-commits.
103
+ - **Starter tools:** wrapped from the repo's detected command surface (scripts, Make/just),
104
+ auto-added to `tools.allow`.
105
+ - **Profile presets:** node-cli, web, python, etc. (detected by the scanner).
106
+ - **Adapters:** agents, claude, copilot, cursor enabled by default.
107
+
108
+ Modern skills use the Agent Skills-style folder shape:
109
+
110
+ ```text
111
+ .threadroot/skills/system-design/
112
+ SKILL.md
113
+ references/
114
+ scripts/
115
+ assets/
116
+ evals/triggers.json
117
+ ```
118
+
119
+ `SKILL.md` should have a clear `description` that says what the skill does and when an
120
+ agent should use it. Keep the body procedural and move long details into `references/`.
121
+ Use `tr skills validate` to catch naming, trigger-description, broken links, missing
122
+ references, eval coverage, and progressive-disclosure issues. Use `tr skills inspect
123
+ <path>` before trusting installed skills; it prints the skill metadata plus references,
124
+ scripts, assets, evals, and declared allowed tools.
125
+
126
+ This repository also includes a public curated pack under `skills/`. Validate it with:
127
+
128
+ ```bash
129
+ tr skills validate --path skills
130
+ tr skills inspect skills/system-design
131
+ ```
132
+
133
+ ## Tools and connections
134
+
135
+ Tools are explicit, testable agent capabilities. They can declare `risk`, `confirm`,
136
+ `connection`, inputs, and an optional finite `healthcheck`.
137
+
138
+ ```bash
139
+ tr tools create --from-command "pnpm test" --description "Run the test suite"
140
+ tr tools check
141
+ tr run test
142
+ ```
143
+
144
+ Connections wrap locally authenticated CLIs without storing secrets:
145
+
146
+ ```bash
147
+ tr connections add aws-dev \
148
+ --provider aws \
149
+ --command aws \
150
+ --profile dev \
151
+ --risk high \
152
+ --confirm \
153
+ --healthcheck "aws sts get-caller-identity --profile dev"
154
+ tr connections check
155
+ ```
156
+
157
+ Use official CLIs for auth (`gh auth login`, `aws configure sso`, `az login`, Snowflake
158
+ CLI config). Threadroot records what the agent may use; it does not become a secret vault.
159
+
160
+ ## Capability packs
161
+
162
+ Packs install curated sets of skills, tools, rules, and connections:
163
+
164
+ ```bash
165
+ tr packs list
166
+ tr packs inspect typescript-node
167
+ tr packs install testing
168
+ ```
169
+
170
+ Built-in v1 packs: `typescript-node`, `react-app`, `python`, `testing`, `code-review`,
171
+ `security-review`, and `system-design`.
172
+
173
+ ## Installing objects
174
+
175
+ ```bash
176
+ tr install github:Sevan1211/threadroot/skills/system-design@main --kind skill
177
+ tr install github:Sevan1211/threadroot/skills/build-tool@main --kind skill
178
+ tr install github:owner/repo/skills/code-review.md@v1
179
+ tr install ./local/tools/echo.yaml --kind tool
180
+ ```
181
+
182
+ Fetches shell out to `git` (shallow clone, no `.git` kept, never runs repo scripts), pin the
183
+ resolved commit SHA plus a `sha256:` integrity digest into `lock.json`, and mark installed
184
+ tools **untrusted** until you add them to `tools.allow`. Skill directories are copied as a
185
+ folder and recorded with a deterministic tree hash. External skills that include scripts
186
+ or declare allowed tools are surfaced by `tr doctor` as trust warnings so humans and agents
187
+ inspect them before use.
188
+
189
+ ## MCP
190
+
191
+ Threadroot runs a local MCP server over stdio that exposes the harness to agents:
192
+
193
+ ```bash
194
+ tr mcp
195
+ tr mcp setup # print config snippets and a pasteable agent bootstrap prompt
196
+ tr mcp setup --write # write project-local MCP config for supported agents
197
+ ```
198
+
199
+ Tools: `context`, `skills_list`, `skills_get`, `tools_list`, `tools_check`, `tools_run`,
200
+ `tools_create`, `tools_detect`, `connections_list`, `connections_check`, `memory_read`,
201
+ `memory_append`, `status`, `doctor`.
202
+
203
+ `tr mcp setup` also prints a copy/paste agent prompt that follows the real CLI flow:
204
+ check availability, run `threadroot init` when needed, inspect `status`, review `diff` on
205
+ drift, and optionally write MCP config.
206
+
207
+ ## Profiles
208
+
209
+ `nextjs`, `vite-react`, `fastapi`, `python-cli`, `node-cli`, `dbt`, `empty`.
210
+
211
+ ## Development
212
+
213
+ ```bash
214
+ pnpm typecheck
215
+ pnpm lint
216
+ pnpm test
217
+ pnpm build
218
+ ```
219
+
220
+ ## Publishing
221
+
222
+ The npm package ships only `dist/`, `skills/`, `packs/`, and package metadata. Before
223
+ publishing:
224
+
225
+ ```bash
226
+ pnpm release:check
227
+ pnpm pack:check
228
+ ```
229
+
230
+ See [RELEASE.md](./RELEASE.md) for the full publish checklist.
231
+
232
+ Contributions should run the same release gate. See [CONTRIBUTING.md](./CONTRIBUTING.md).
233
+
234
+ ## Smoke test this checkout
235
+
236
+ Use a temporary copy when testing generated files against Threadroot itself:
237
+
238
+ ```bash
239
+ pnpm install
240
+ pnpm build
241
+ THREADROOT_ROOT="$(pwd)"
242
+ TMP_REPO="$(mktemp -d /tmp/threadroot-smoke.XXXXXX)"
243
+ rsync -a --exclude .git --exclude node_modules --exclude dist ./ "$TMP_REPO/"
244
+ cd "$TMP_REPO"
245
+ node "$THREADROOT_ROOT/dist/index.js" init --no-import
246
+ node "$THREADROOT_ROOT/dist/index.js" status
247
+ node "$THREADROOT_ROOT/dist/index.js" context "write tests"
248
+ node "$THREADROOT_ROOT/dist/index.js" skills validate
249
+ node "$THREADROOT_ROOT/dist/index.js" skills validate --path skills
250
+ node "$THREADROOT_ROOT/dist/index.js" skills inspect skills/system-design
251
+ node "$THREADROOT_ROOT/dist/index.js" packs list
252
+ node "$THREADROOT_ROOT/dist/index.js" packs inspect testing
253
+ node "$THREADROOT_ROOT/dist/index.js" tools create --from-command "node --version" --description "Check Node.js"
254
+ node "$THREADROOT_ROOT/dist/index.js" tools check
255
+ node "$THREADROOT_ROOT/dist/index.js" connections add node-local --provider node --command node --risk low --healthcheck "node --version"
256
+ node "$THREADROOT_ROOT/dist/index.js" connections check
257
+ node "$THREADROOT_ROOT/dist/index.js" compile
258
+ node "$THREADROOT_ROOT/dist/index.js" diff
259
+ node "$THREADROOT_ROOT/dist/index.js" doctor
260
+ find .threadroot -maxdepth 2 -type f | sort
261
+ ```
package/SECURITY.md ADDED
@@ -0,0 +1,22 @@
1
+ # Security Policy
2
+
3
+ Threadroot is local-first software that can expose executable tools to coding agents. Treat harness changes with the same care as package scripts, Make targets, shell scripts, and Git hooks.
4
+
5
+ ## Supported versions
6
+
7
+ Threadroot is pre-1.0. Security fixes will target the latest published version.
8
+
9
+ ## Reporting vulnerabilities
10
+
11
+ Please report security issues privately before opening a public issue. Until a dedicated contact exists, use GitHub private vulnerability reporting for the repository if available.
12
+
13
+ ## Security model
14
+
15
+ - Threadroot does not store cloud secrets.
16
+ - Connections wrap locally authenticated CLIs such as `gh`, `aws`, `az`, or Snowflake CLI.
17
+ - Tools are explicit YAML manifests and run locally with the user's permissions.
18
+ - High-risk and confirmation-marked tools require explicit confirmation.
19
+ - External installed tools are blocked until allow-listed.
20
+ - `threadroot doctor` reports drift, unsafe tool trust, connection health, and MCP setup hints.
21
+
22
+ Always inspect third-party skills, tools, connections, and packs before installing them into a trusted repo.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node