@tricknowtech/context 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.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @tricknowtech/context
2
+
3
+ Carry a project's LLM context — memory, skills, instructions, and where you left off — between machines.
4
+
5
+ Local-first: the store is a plain directory you commit to your repo, so context travels with the code. No account, no server, works offline. A hosted Tricknowtech remote is optional and comes later.
6
+
7
+ ```bash
8
+ npx @tricknowtech/context init
9
+ ```
10
+
11
+ ## The problem
12
+
13
+ Open the same project on a second machine and the assistant knows nothing. Your instruction files travel with the repo, but the parts that actually accumulate — the per-project memory, your custom skills, and the thread of what you were doing — live in `~/.claude` and never leave the machine that built them.
14
+
15
+ ## What it does
16
+
17
+ `ctx init` creates `.contextsync/` and installs a `/context` slash command. From then on:
18
+
19
+ ```bash
20
+ ctx push # collect context into the store
21
+ ctx pull # restore it on another machine
22
+ ctx status # what changed since the last push
23
+ ```
24
+
25
+ Commit `.contextsync/` and your teammates — and your other laptop — get the same context on clone.
26
+
27
+ ### It skips what git already carries
28
+
29
+ Your `CLAUDE.md` is already in the repo, so copying it into the store would just create a second copy that drifts. The collector checks `git ls-files` and leaves tracked files alone. What it *does* capture is the part that never travels:
30
+
31
+ | Store path | Comes from |
32
+ |---|---|
33
+ | `memory/` | `~/.claude/projects/<project-key>/memory/` |
34
+ | `skills/` | `~/.claude/skills/` |
35
+ | `agents/` | `~/.claude/agents/` |
36
+ | `user/` | `~/.claude/CLAUDE.md`, `settings.json` |
37
+ | `project/` | untracked instruction files in the repo |
38
+ | `artifacts/` | derived indexes, opt-in (`--artifacts`) |
39
+ | `handoff.json` | written by `/context push` |
40
+
41
+ ### Paths are rewritten on restore
42
+
43
+ Claude Code names its per-project directories after the absolute project path — `/root/my-app` becomes `-root-my-app`. Clone the repo somewhere else and that key is wrong. The manifest stores paths as templates (`{userClaude}/projects/{cwdKey}/memory/…`) and `ctx pull` recomputes them for wherever the repo actually lives.
44
+
45
+ ### The handoff
46
+
47
+ `/context push` asks the model to write `.contextsync/handoff.json` first — goal, decisions made, open threads, files touched, next step. Only the model has the conversation; only the CLI has the disk, so the slash command is the one place both are available.
48
+
49
+ On the other machine, `/context pull` restores everything and reads the handoff back, so the new session starts oriented instead of blank.
50
+
51
+ ## Safety
52
+
53
+ The store gets committed, and a committed credential is permanent — so `ctx push` scans everything first and **refuses** if it finds anything that looks like a secret:
54
+
55
+ ```
56
+ Refusing to push — 2 possible secrets found:
57
+
58
+ user/settings.json:14 [assigned-secret] wJal********MPLEK
59
+ memory/deploy.md:8 [aws-access-key-id] AKIA********MPLE
60
+
61
+ These would be committed to the repository and be very hard to remove.
62
+ ```
63
+
64
+ `.env` files, `~/.claude/.credentials.json`, `.claude.json`, and private keys are never collected at all, at any tier.
65
+
66
+ Session transcripts are excluded from local mode entirely. They run to hundreds of megabytes, are append-only, and carry the largest leak surface (full tool output). They will be supported through the hosted remote, where content-addressed chunking makes them practical.
67
+
68
+ ## Options
69
+
70
+ | Flag | Effect |
71
+ |---|---|
72
+ | `--artifacts` | include derived indexes (`graphify-out/`, etc.) |
73
+ | `--dry-run` | show what would sync, write nothing |
74
+ | `--force` | `init`: overwrite config · `pull`: overwrite differing files |
75
+ | `--allow-secrets` | push despite scan hits — think first |
76
+
77
+ `ctx pull` never overwrites a local file whose contents differ; it lists them and leaves them alone until you pass `--force`.
78
+
79
+ ## Configuration
80
+
81
+ `.contextsync/config.json`:
82
+
83
+ ```json
84
+ {
85
+ "projectId": "…",
86
+ "name": "my-app",
87
+ "rootHint": "/root/my-app",
88
+ "tiers": ["core", "handoff"],
89
+ "artifactPaths": ["graphify-out"],
90
+ "exclude": ["**/*.log"],
91
+ "remotes": {}
92
+ }
93
+ ```
94
+
95
+ ## Programmatic use
96
+
97
+ ```ts
98
+ import { collect, findProjectRoot, loadConfig, LocalStore } from '@tricknowtech/context'
99
+
100
+ const root = findProjectRoot()!
101
+ const cfg = loadConfig(root)!
102
+ const { files, skippedTracked } = collect(root, cfg, ['core'])
103
+ new LocalStore(root).write(files, root)
104
+ ```
105
+
106
+ ## License
107
+
108
+ ISC © Tricknowtech