ctxbin 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 superlucky84
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,133 @@
1
+ # ctxbin
2
+
3
+ Minimal, deterministic CLI to save and load **context**, **agents**, and **skills** in Upstash Redis hashes.
4
+ It is designed for fast handoff between AI agents working on the same repo/branch,
5
+ with branch-based context keys inferred inside git repositories.
6
+
7
+ > **Core idea:** ctxbin exists to make AI-agent handoffs reliable and repeatable.
8
+
9
+ ## Agent workflow (core)
10
+ This is the most important usage. Paste the add-on into your agent instruction file
11
+ so agents consistently save and load branch context.
12
+
13
+ - Add: [`agent-addon.md`](agent-addon.md) → copy the block into your project's agent instruction file
14
+ (e.g. `AGENT.md`, `CLAUDE.md`, or any equivalent).
15
+ - Then you can simply ask:
16
+ - “Use ctxbin to save the current context.”
17
+ - “Use ctxbin to load the current context.”
18
+
19
+ The add-on tells agents how to format context (summary, next steps, decisions) and how to use
20
+ `ctxbin ctx save/load` correctly.
21
+
22
+ ## Features
23
+ - Branch-scoped `ctx` keys (auto-inferred from git repo + branch)
24
+ - `agent` and `skill` storage for reusable prompts and workflows
25
+ - `skillpack`: tar.gz + Base64 directory bundles (deterministic)
26
+ - `skillref`: GitHub directory reference (default branch or pinned commit)
27
+ - `list` command with type mapping (`--value`, `--dir`, `--url`)
28
+
29
+ ## Install
30
+ Recommended (no install):
31
+ ```bash
32
+ npx ctxbin --version
33
+ ```
34
+
35
+ Or add it to your toolchain:
36
+ ```bash
37
+ pnpm add -g ctxbin
38
+ ```
39
+
40
+ ## Upstash requirement
41
+ ctxbin stores data in **Upstash Redis**. You need an Upstash database and its REST URL/token.
42
+
43
+ - Create a database at: https://upstash.com/
44
+ - Use the REST URL and token as `CTXBIN_STORE_URL` / `CTXBIN_STORE_TOKEN`
45
+
46
+ ## Configure storage
47
+ Use environment variables (recommended):
48
+ ```bash
49
+ export CTXBIN_STORE_URL="https://..."
50
+ export CTXBIN_STORE_TOKEN="..."
51
+ ```
52
+
53
+ Or create `~/.ctxbin/config.json` via interactive init:
54
+ ```bash
55
+ npx ctxbin init
56
+ ```
57
+
58
+ ## Quick usage
59
+ ### ctx (branch-scoped, key optional in git repos)
60
+ ```bash
61
+ ctxbin ctx save --value "summary / next steps"
62
+ ctxbin ctx load
63
+ ctxbin ctx list
64
+ ctxbin ctx delete
65
+ ```
66
+
67
+ When the key is omitted, ctxbin infers it **only inside a git repository**:
68
+ ```
69
+ key = {project}/{branch}
70
+ project = git repository root directory name
71
+ branch = git rev-parse --abbrev-ref HEAD
72
+ ```
73
+
74
+ Explicit key example (useful outside git repos; not recommended for normal use):
75
+ ```bash
76
+ ctxbin ctx save my-project/main --value "summary / next steps"
77
+ ctxbin ctx load my-project/main
78
+ ctxbin ctx delete my-project/main
79
+ ```
80
+
81
+ ### agent (string-only)
82
+ ```bash
83
+ ctxbin agent save reviewer --value "# Agent role"
84
+ ctxbin agent load reviewer
85
+ ctxbin agent list
86
+ ctxbin agent delete reviewer
87
+ ```
88
+
89
+ ### skill (string, skillpack, or skillref)
90
+ ```bash
91
+ ctxbin skill save my-skill --value "# Skill markdown"
92
+ ctxbin skill load my-skill
93
+ ctxbin skill list
94
+ ctxbin skill delete my-skill
95
+ ```
96
+
97
+ Skillpack (directory bundle):
98
+ ```bash
99
+ ctxbin skill save fp-pack --dir ./skills/fp-pack
100
+ ctxbin skill load fp-pack --dir ./tmp/fp-pack
101
+ ```
102
+
103
+ Skillref (GitHub directory reference):
104
+ ```bash
105
+ # Track default branch
106
+ ctxbin skill save fp-pack \
107
+ --url https://github.com/OWNER/REPO \
108
+ --path skills/fp-pack
109
+
110
+ # Pin to a commit
111
+ ctxbin skill save fp-pack \
112
+ --url https://github.com/OWNER/REPO \
113
+ --ref <40-hex-commit-sha> \
114
+ --path skills/fp-pack
115
+ ```
116
+
117
+ > `skill load` for skillpack/skillref requires `--dir`.
118
+
119
+ ## Built-in guidance
120
+ Print the bundled ctxbin skill text (built-in):
121
+ ```bash
122
+ npx ctxbin skill load ctxbin
123
+ ```
124
+
125
+ ## Development
126
+ ```bash
127
+ pnpm install
128
+ pnpm build
129
+ pnpm test
130
+ ```
131
+
132
+ ## License
133
+ MIT
package/agent-addon.md ADDED
@@ -0,0 +1,47 @@
1
+ # ctxbin Agent Add‑On
2
+
3
+ Copy/paste the block between the markers below into your AGENT.md / CLAUDE.md.
4
+
5
+ <!-- BEGIN CTXBIN AGENT ADDON -->
6
+
7
+ ## ctxbin (Context Persistence)
8
+
9
+ Use `ctxbin ctx save` to store **branch‑scoped context** so the next agent can continue without re‑explanation.
10
+ > Tip: `npx ctxbin skill load ctxbin` prints the bundled ctxbin skill text
11
+ > so agents can reference the full ctxbin guidance.
12
+
13
+ ### How ctx keys are inferred (when key is omitted)
14
+ ```
15
+ key = {project}/{branch}
16
+ project = git repository root directory name
17
+ branch = git rev-parse --abbrev-ref HEAD
18
+ ```
19
+
20
+ ### Save context (preferred)
21
+ ```bash
22
+ ctxbin ctx save --value "<summary + next steps + decisions>"
23
+ ```
24
+
25
+ ### Save via stdin
26
+ ```bash
27
+ echo "<context>" | ctxbin ctx save
28
+ ```
29
+
30
+ ### Load context
31
+ ```bash
32
+ ctxbin ctx load
33
+ ```
34
+
35
+ ### What to include in ctx
36
+ - What changed (summary)
37
+ - What remains (next steps)
38
+ - Completed vs remaining checklist items
39
+ - Important decisions/constraints
40
+ - Files touched and why
41
+ - Failing tests or warnings
42
+
43
+ ### Do not
44
+ - Don’t store secrets
45
+ - Don’t overwrite with trivial messages
46
+
47
+ <!-- END CTXBIN AGENT ADDON -->
@@ -0,0 +1,47 @@
1
+ # ctxbin Agent Add‑On
2
+
3
+ Copy/paste the block between the markers below into your AGENT.md / CLAUDE.md.
4
+
5
+ <!-- BEGIN CTXBIN AGENT ADDON -->
6
+
7
+ ## ctxbin (Context Persistence)
8
+
9
+ Use `ctxbin ctx save` to store **branch‑scoped context** so the next agent can continue without re‑explanation.
10
+ > Tip: `npx ctxbin skill load ctxbin` prints the bundled ctxbin skill text
11
+ > so agents can reference the full ctxbin guidance.
12
+
13
+ ### How ctx keys are inferred (when key is omitted)
14
+ ```
15
+ key = {project}/{branch}
16
+ project = git repository root directory name
17
+ branch = git rev-parse --abbrev-ref HEAD
18
+ ```
19
+
20
+ ### Save context (preferred)
21
+ ```bash
22
+ ctxbin ctx save --value "<summary + next steps + decisions>"
23
+ ```
24
+
25
+ ### Save via stdin
26
+ ```bash
27
+ echo "<context>" | ctxbin ctx save
28
+ ```
29
+
30
+ ### Load context
31
+ ```bash
32
+ ctxbin ctx load
33
+ ```
34
+
35
+ ### What to include in ctx
36
+ - What changed (summary)
37
+ - What remains (next steps)
38
+ - Completed vs remaining checklist items
39
+ - Important decisions/constraints
40
+ - Files touched and why
41
+ - Failing tests or warnings
42
+
43
+ ### Do not
44
+ - Don’t store secrets
45
+ - Don’t overwrite with trivial messages
46
+
47
+ <!-- END CTXBIN AGENT ADDON -->