kijito-claude 0.1.0__tar.gz
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.
- kijito_claude-0.1.0/.gitignore +15 -0
- kijito_claude-0.1.0/CLAUDE.md.snippet +31 -0
- kijito_claude-0.1.0/LICENSE +201 -0
- kijito_claude-0.1.0/NOTICE +6 -0
- kijito_claude-0.1.0/PKG-INFO +140 -0
- kijito_claude-0.1.0/README.md +117 -0
- kijito_claude-0.1.0/install.sh +56 -0
- kijito_claude-0.1.0/pyproject.toml +57 -0
- kijito_claude-0.1.0/scripts/arm-session.sh +17 -0
- kijito_claude-0.1.0/scripts/claude-armed.sh +13 -0
- kijito_claude-0.1.0/scripts/kijito-qa-pass.sh +8 -0
- kijito_claude-0.1.0/scripts/lifecycle-lib.sh +43 -0
- kijito_claude-0.1.0/scripts/myctx.sh +12 -0
- kijito_claude-0.1.0/scripts/self-clear.sh +43 -0
- kijito_claude-0.1.0/scripts/session-autosend.sh +31 -0
- kijito_claude-0.1.0/scripts/session-catchup-hint.sh +26 -0
- kijito_claude-0.1.0/scripts/statusline-context.sh +34 -0
- kijito_claude-0.1.0/skills/kijito-qa-memory/SKILL.md +70 -0
- kijito_claude-0.1.0/skills/kijito-start/SKILL.md +53 -0
- kijito_claude-0.1.0/src/kijito_claude/__init__.py +3 -0
- kijito_claude-0.1.0/src/kijito_claude/cli.py +38 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# runtime state (created by the scripts at ~/.claude/.lifecycle; never committed)
|
|
2
|
+
.lifecycle/
|
|
3
|
+
*.bak
|
|
4
|
+
*.bak.*
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.pyc
|
|
7
|
+
.DS_Store
|
|
8
|
+
|
|
9
|
+
# build artifacts (npm + python packaging). package-lock.json IS committed (npm ci needs it).
|
|
10
|
+
node_modules/
|
|
11
|
+
*.tgz
|
|
12
|
+
dist/
|
|
13
|
+
build/
|
|
14
|
+
*.egg-info/
|
|
15
|
+
.venv/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!-- Paste into your ~/.claude/CLAUDE.md. This is the doctrine the agent follows; the scripts are
|
|
2
|
+
the mechanism. (Kijito-flavored; for standalone use, swap "memory/kijito_startup" for your
|
|
3
|
+
own notes/handoff system and set KIJITO_MODE=off.) -->
|
|
4
|
+
|
|
5
|
+
## Context self-check — NEVER pause on a *feeling* of being full
|
|
6
|
+
|
|
7
|
+
Your felt-sense of context usage is unreliable — you routinely feel "full" at 30-50% when you are
|
|
8
|
+
nowhere near. **NEVER stop, hand off, or recycle a session because you *feel* low on context. Get
|
|
9
|
+
hard data first:** run `~/.claude/myctx.sh` (prints `context: N tok = X% of 1M`; reads the API's own
|
|
10
|
+
token ledger for THIS session, matches `/context`, costs ~2 tokens). Only act on the real percentage.
|
|
11
|
+
A live `<total_tokens>` countdown in your context is also authoritative. NEVER `Read` the raw
|
|
12
|
+
transcript `.jsonl` to check — that dumps ~100k tokens into context.
|
|
13
|
+
|
|
14
|
+
## Session start — catch up BEFORE the user's task
|
|
15
|
+
|
|
16
|
+
On your FIRST action in any session (fresh, after `/clear`, or after compaction), before the task:
|
|
17
|
+
catch up on memory/notes and arm your inbox. If you were auto-started (armed pane) and your
|
|
18
|
+
current-state / next-steps pointer shows ACTIVE WORK, resume it autonomously to its DONE-WHEN rather
|
|
19
|
+
than waiting for a prompt.
|
|
20
|
+
|
|
21
|
+
## Self-clear when armed (recycle context without losing the thread)
|
|
22
|
+
|
|
23
|
+
Self-clear runs ONLY on an ARMED pane (launch `~/.claude/claude-armed.sh`, or when the user says
|
|
24
|
+
"enable self-clear / go autonomous" run `~/.claude/arm-session.sh on`; plain `claude` is human-managed
|
|
25
|
+
and CANNOT self-clear). When armed AND your context is genuinely high (~75-80%+ measured) AND you're at
|
|
26
|
+
a safe stopping point: (1) run `/kijito-qa-memory` (curate — CREATE what's missing AND correct what's
|
|
27
|
+
stale — preload the `RESUME NOW:` pointer, cold-boot-verify a fresh agent can resume, record the pass
|
|
28
|
+
token); (2) ONLY THEN run `~/.claude/self-clear.sh` as your FINAL action. After `/clear`, SessionStart
|
|
29
|
+
re-catches-up and resumes. If the work is DONE, mark the pointer COMPLETE (no `RESUME NOW`) so the loop
|
|
30
|
+
stops. Kill switch: `touch ~/.claude/.lifecycle/STOP`. `/clear` is a one-way wipe — never self-clear on
|
|
31
|
+
a hunch or with a thin handoff.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Arcada Labs
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kijito-claude
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Installer for the kijito-claude toolkit — context tracking, session catch-up, and self-clear scripts plus the Kijito skills, deployed into ~/.claude.
|
|
5
|
+
Project-URL: Homepage, https://github.com/KijitoAI/kijito-claude
|
|
6
|
+
Project-URL: Repository, https://github.com/KijitoAI/kijito-claude
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/KijitoAI/kijito-claude/issues
|
|
8
|
+
Author-email: Arcada Labs <jason@arcadalabs.com>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Keywords: anthropic,claude,claude-code,cli,installer,kijito,skills
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Operating System :: POSIX
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# kijito-claude
|
|
25
|
+
|
|
26
|
+
Tools for Claude Code sessions to track their own context window and, optionally, run unattended.
|
|
27
|
+
A session can catch up on memory at startup, report how much of its context window is actually in
|
|
28
|
+
use, and recycle its context at high usage without losing the working state. It uses
|
|
29
|
+
[Kijito](https://kijito.ai) as the memory backend by default, and also runs standalone (see
|
|
30
|
+
"Running without Kijito").
|
|
31
|
+
|
|
32
|
+
Everything here is optional. The catch-up and curation steps are a handful of memory calls you can
|
|
33
|
+
run by hand; the scripts and the two skills just make the routine uniform and easy to deploy across
|
|
34
|
+
machines. Install only the pieces you want — the context check stands alone, the autonomy harness is
|
|
35
|
+
opt-in per pane, and the skills are convenience wrappers, not requirements.
|
|
36
|
+
|
|
37
|
+
## Components
|
|
38
|
+
|
|
39
|
+
| Component | What it does | Needs Kijito |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `myctx.sh`, `statusline-context.sh` | Report actual context-window usage from the API token counts recorded in the session transcript (the same numbers `/context` shows). Cheap to call. The statusline shows it live. | No |
|
|
42
|
+
| Session catch-up (`session-catchup-hint.sh`, a SessionStart hook) | Each session catches up on memory and notes before it starts on the task. | Optional |
|
|
43
|
+
| Armed-pane autonomy (`claude-armed.sh`, `arm-session.sh`, `session-autosend.sh`) | An armed tmux pane sends itself a first prompt and continues preloaded work. Arming is per pane, so one pane can run unattended while you drive another. | Optional |
|
|
44
|
+
| Self-clear loop (`self-clear.sh`, `lifecycle-lib.sh`, `kijito-qa-pass.sh`) | At high measured context, the session curates memory, confirms a fresh session can resume, runs `/clear`, then catches up again and continues. Gated so it will not clear with unsaved work. | Optional (see note) |
|
|
45
|
+
| `kijito-start` skill | The active, thorough version of session catch-up: load memory, read the current-state pointer and recent lessons, arm the inbox, and resume active work — or, for a new persona, set up identity and the pointer. | Yes |
|
|
46
|
+
| `kijito-qa-memory` skill | Memory curation that requires writing the new memories (not only fixing existing ones), then uses a fresh subagent to confirm a cold start can reconstruct the work. | Yes |
|
|
47
|
+
|
|
48
|
+
The two skills are conveniences, not the only way in: an agent can run the same catch-up and
|
|
49
|
+
curation by hand from a few prompts. They are packaged as skills because that makes them simple to
|
|
50
|
+
drop into `~/.claude/skills/` and invoke the same way everywhere.
|
|
51
|
+
|
|
52
|
+
The self-clear loop needs some durable store to carry the handoff across `/clear`. That is Kijito by
|
|
53
|
+
default; a notes file works in standalone mode.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
From source:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git clone https://github.com/KijitoAI/kijito-claude
|
|
61
|
+
cd kijito-claude && ./install.sh
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or, once the v0.1 packages are published, with a package runner (no clone needed):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx kijito-claude # via npm
|
|
68
|
+
pipx run kijito-claude # via PyPI (uvx kijito-claude also works)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Both package runners do the same thing as the from-source install: they bundle the scripts and
|
|
72
|
+
skills and run `install.sh`. They need `bash`, so on Windows run them inside WSL (see Platform
|
|
73
|
+
support).
|
|
74
|
+
|
|
75
|
+
The installer copies the scripts to `~/.claude/`, deploys the skills to `~/.claude/skills/`, drops
|
|
76
|
+
the CLAUDE.md doctrine snippet alongside them, and merges the keys it needs into `settings.json`. It
|
|
77
|
+
backs up `settings.json` and merges with `jq`, so it leaves your existing settings alone and is safe
|
|
78
|
+
to re-run, including on other machines. Requires `jq`. The autonomy features require `tmux`.
|
|
79
|
+
|
|
80
|
+
## Platform support
|
|
81
|
+
|
|
82
|
+
The scripts are POSIX-style `bash` and avoid GNU-only flags (epoch and timestamp formatting work on
|
|
83
|
+
both BSD and GNU `date`), so they run the same on Linux and macOS.
|
|
84
|
+
|
|
85
|
+
| Platform | Context check | Catch-up + skills | Armed-pane autonomy / self-clear |
|
|
86
|
+
|---|---|---|---|
|
|
87
|
+
| Linux | yes | yes | yes (needs `tmux`) |
|
|
88
|
+
| macOS | yes | yes | yes (needs `tmux`) |
|
|
89
|
+
| Windows via WSL | yes | yes | yes — run `claude` inside the WSL distro, where `tmux` works |
|
|
90
|
+
| Windows native (no WSL) | with Git Bash | with Git Bash | no — `tmux` is not available |
|
|
91
|
+
|
|
92
|
+
On Windows, use WSL: install and launch `claude` inside the Linux distro and everything works as it
|
|
93
|
+
does on native Linux. The autonomy harness drives a session by typing into its own `tmux` pane, which
|
|
94
|
+
has no native-Windows equivalent, so without WSL only the context check and the by-hand catch-up
|
|
95
|
+
apply. Requirements everywhere: `bash` and `jq`; add `tmux` for the autonomy features.
|
|
96
|
+
|
|
97
|
+
## Managed vs. autonomous panes
|
|
98
|
+
|
|
99
|
+
Arming is per pane.
|
|
100
|
+
|
|
101
|
+
| | plain `claude` | armed pane |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| Catch-up | reminder only; you send the first prompt | sends its own first prompt |
|
|
104
|
+
| Self-clear | not allowed; you manage context | allowed, after the gate below |
|
|
105
|
+
|
|
106
|
+
To arm a pane, launch it with `~/.claude/claude-armed.sh`, or tell the agent to go autonomous
|
|
107
|
+
mid-session and it runs `~/.claude/arm-session.sh on` (`off` turns it back off). A plain `claude`
|
|
108
|
+
session stays under your control.
|
|
109
|
+
|
|
110
|
+
## Self-clear gate
|
|
111
|
+
|
|
112
|
+
A pane clears itself only after both steps:
|
|
113
|
+
|
|
114
|
+
1. `/kijito-qa-memory` curates memory, writes a current-state note that begins with `RESUME NOW:`,
|
|
115
|
+
and confirms with a fresh subagent that a cold start can resume. It records a pass token.
|
|
116
|
+
2. `self-clear.sh` checks that the pane is armed, is in tmux, has a fresh token, and is under the
|
|
117
|
+
cycle cap.
|
|
118
|
+
|
|
119
|
+
It then runs `/clear`. The SessionStart hook catches the new session up and it resumes from the note.
|
|
120
|
+
To stop all autonomous sending and clearing, create the file `~/.claude/.lifecycle/STOP`.
|
|
121
|
+
|
|
122
|
+
## Running without Kijito
|
|
123
|
+
|
|
124
|
+
The context check (`myctx.sh`) has no dependencies; install and run it.
|
|
125
|
+
|
|
126
|
+
For the autonomy harness, set `KIJITO_MODE=off` for a generic catch-up prompt, or set your own with
|
|
127
|
+
`KIJITO_AUTOCATCHUP_PROMPT`. The self-clear gate only requires that some curation step write the pass
|
|
128
|
+
token (`~/.claude/kijito-qa-pass.sh`). Kijito is the default backend, not a requirement.
|
|
129
|
+
|
|
130
|
+
## Tests
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
bash tests/lc_test.sh
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Covers arming, the token gate, the cycle cap, the checkpoint, the kill switch, and auto-send.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
Apache 2.0. Copyright 2026 Arcada Labs. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# kijito-claude
|
|
2
|
+
|
|
3
|
+
Tools for Claude Code sessions to track their own context window and, optionally, run unattended.
|
|
4
|
+
A session can catch up on memory at startup, report how much of its context window is actually in
|
|
5
|
+
use, and recycle its context at high usage without losing the working state. It uses
|
|
6
|
+
[Kijito](https://kijito.ai) as the memory backend by default, and also runs standalone (see
|
|
7
|
+
"Running without Kijito").
|
|
8
|
+
|
|
9
|
+
Everything here is optional. The catch-up and curation steps are a handful of memory calls you can
|
|
10
|
+
run by hand; the scripts and the two skills just make the routine uniform and easy to deploy across
|
|
11
|
+
machines. Install only the pieces you want — the context check stands alone, the autonomy harness is
|
|
12
|
+
opt-in per pane, and the skills are convenience wrappers, not requirements.
|
|
13
|
+
|
|
14
|
+
## Components
|
|
15
|
+
|
|
16
|
+
| Component | What it does | Needs Kijito |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `myctx.sh`, `statusline-context.sh` | Report actual context-window usage from the API token counts recorded in the session transcript (the same numbers `/context` shows). Cheap to call. The statusline shows it live. | No |
|
|
19
|
+
| Session catch-up (`session-catchup-hint.sh`, a SessionStart hook) | Each session catches up on memory and notes before it starts on the task. | Optional |
|
|
20
|
+
| Armed-pane autonomy (`claude-armed.sh`, `arm-session.sh`, `session-autosend.sh`) | An armed tmux pane sends itself a first prompt and continues preloaded work. Arming is per pane, so one pane can run unattended while you drive another. | Optional |
|
|
21
|
+
| Self-clear loop (`self-clear.sh`, `lifecycle-lib.sh`, `kijito-qa-pass.sh`) | At high measured context, the session curates memory, confirms a fresh session can resume, runs `/clear`, then catches up again and continues. Gated so it will not clear with unsaved work. | Optional (see note) |
|
|
22
|
+
| `kijito-start` skill | The active, thorough version of session catch-up: load memory, read the current-state pointer and recent lessons, arm the inbox, and resume active work — or, for a new persona, set up identity and the pointer. | Yes |
|
|
23
|
+
| `kijito-qa-memory` skill | Memory curation that requires writing the new memories (not only fixing existing ones), then uses a fresh subagent to confirm a cold start can reconstruct the work. | Yes |
|
|
24
|
+
|
|
25
|
+
The two skills are conveniences, not the only way in: an agent can run the same catch-up and
|
|
26
|
+
curation by hand from a few prompts. They are packaged as skills because that makes them simple to
|
|
27
|
+
drop into `~/.claude/skills/` and invoke the same way everywhere.
|
|
28
|
+
|
|
29
|
+
The self-clear loop needs some durable store to carry the handoff across `/clear`. That is Kijito by
|
|
30
|
+
default; a notes file works in standalone mode.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
From source:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/KijitoAI/kijito-claude
|
|
38
|
+
cd kijito-claude && ./install.sh
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or, once the v0.1 packages are published, with a package runner (no clone needed):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx kijito-claude # via npm
|
|
45
|
+
pipx run kijito-claude # via PyPI (uvx kijito-claude also works)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Both package runners do the same thing as the from-source install: they bundle the scripts and
|
|
49
|
+
skills and run `install.sh`. They need `bash`, so on Windows run them inside WSL (see Platform
|
|
50
|
+
support).
|
|
51
|
+
|
|
52
|
+
The installer copies the scripts to `~/.claude/`, deploys the skills to `~/.claude/skills/`, drops
|
|
53
|
+
the CLAUDE.md doctrine snippet alongside them, and merges the keys it needs into `settings.json`. It
|
|
54
|
+
backs up `settings.json` and merges with `jq`, so it leaves your existing settings alone and is safe
|
|
55
|
+
to re-run, including on other machines. Requires `jq`. The autonomy features require `tmux`.
|
|
56
|
+
|
|
57
|
+
## Platform support
|
|
58
|
+
|
|
59
|
+
The scripts are POSIX-style `bash` and avoid GNU-only flags (epoch and timestamp formatting work on
|
|
60
|
+
both BSD and GNU `date`), so they run the same on Linux and macOS.
|
|
61
|
+
|
|
62
|
+
| Platform | Context check | Catch-up + skills | Armed-pane autonomy / self-clear |
|
|
63
|
+
|---|---|---|---|
|
|
64
|
+
| Linux | yes | yes | yes (needs `tmux`) |
|
|
65
|
+
| macOS | yes | yes | yes (needs `tmux`) |
|
|
66
|
+
| Windows via WSL | yes | yes | yes — run `claude` inside the WSL distro, where `tmux` works |
|
|
67
|
+
| Windows native (no WSL) | with Git Bash | with Git Bash | no — `tmux` is not available |
|
|
68
|
+
|
|
69
|
+
On Windows, use WSL: install and launch `claude` inside the Linux distro and everything works as it
|
|
70
|
+
does on native Linux. The autonomy harness drives a session by typing into its own `tmux` pane, which
|
|
71
|
+
has no native-Windows equivalent, so without WSL only the context check and the by-hand catch-up
|
|
72
|
+
apply. Requirements everywhere: `bash` and `jq`; add `tmux` for the autonomy features.
|
|
73
|
+
|
|
74
|
+
## Managed vs. autonomous panes
|
|
75
|
+
|
|
76
|
+
Arming is per pane.
|
|
77
|
+
|
|
78
|
+
| | plain `claude` | armed pane |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| Catch-up | reminder only; you send the first prompt | sends its own first prompt |
|
|
81
|
+
| Self-clear | not allowed; you manage context | allowed, after the gate below |
|
|
82
|
+
|
|
83
|
+
To arm a pane, launch it with `~/.claude/claude-armed.sh`, or tell the agent to go autonomous
|
|
84
|
+
mid-session and it runs `~/.claude/arm-session.sh on` (`off` turns it back off). A plain `claude`
|
|
85
|
+
session stays under your control.
|
|
86
|
+
|
|
87
|
+
## Self-clear gate
|
|
88
|
+
|
|
89
|
+
A pane clears itself only after both steps:
|
|
90
|
+
|
|
91
|
+
1. `/kijito-qa-memory` curates memory, writes a current-state note that begins with `RESUME NOW:`,
|
|
92
|
+
and confirms with a fresh subagent that a cold start can resume. It records a pass token.
|
|
93
|
+
2. `self-clear.sh` checks that the pane is armed, is in tmux, has a fresh token, and is under the
|
|
94
|
+
cycle cap.
|
|
95
|
+
|
|
96
|
+
It then runs `/clear`. The SessionStart hook catches the new session up and it resumes from the note.
|
|
97
|
+
To stop all autonomous sending and clearing, create the file `~/.claude/.lifecycle/STOP`.
|
|
98
|
+
|
|
99
|
+
## Running without Kijito
|
|
100
|
+
|
|
101
|
+
The context check (`myctx.sh`) has no dependencies; install and run it.
|
|
102
|
+
|
|
103
|
+
For the autonomy harness, set `KIJITO_MODE=off` for a generic catch-up prompt, or set your own with
|
|
104
|
+
`KIJITO_AUTOCATCHUP_PROMPT`. The self-clear gate only requires that some curation step write the pass
|
|
105
|
+
token (`~/.claude/kijito-qa-pass.sh`). Kijito is the default backend, not a requirement.
|
|
106
|
+
|
|
107
|
+
## Tests
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
bash tests/lc_test.sh
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Covers arming, the token gate, the cycle cap, the checkpoint, the kill switch, and auto-send.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
Apache 2.0. Copyright 2026 Arcada Labs. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# kijito-claude installer — deploys the toolkit into ~/.claude and merges settings.json.
|
|
3
|
+
# Idempotent + non-destructive: backs up settings.json, jq-merges keys (no clobber), de-dups the hook.
|
|
4
|
+
# Also the cross-machine/fleet installer: clone the repo on any box and run this.
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
REPO="$(cd "$(dirname "$0")" && pwd)"
|
|
7
|
+
DEST="$HOME/.claude"
|
|
8
|
+
command -v jq >/dev/null 2>&1 || { echo "ERROR: jq is required."; exit 1; }
|
|
9
|
+
command -v tmux >/dev/null 2>&1 || echo "WARN: tmux not found — armed-pane autonomy + auto-send need tmux. (Context self-check works without it.)"
|
|
10
|
+
|
|
11
|
+
mkdir -p "$DEST/skills" "$DEST/.lifecycle"
|
|
12
|
+
|
|
13
|
+
# 1) scripts → ~/.claude (executable)
|
|
14
|
+
for s in "$REPO"/scripts/*.sh; do install -m 0755 "$s" "$DEST/$(basename "$s")"; done
|
|
15
|
+
echo "✓ scripts installed → $DEST"
|
|
16
|
+
|
|
17
|
+
# 2) skills (optional helpers — every skill in skills/ gets deployed)
|
|
18
|
+
for d in "$REPO"/skills/*/; do
|
|
19
|
+
name="$(basename "$d")"
|
|
20
|
+
[ -f "$d/SKILL.md" ] || continue
|
|
21
|
+
mkdir -p "$DEST/skills/$name"
|
|
22
|
+
install -m 0644 "$d/SKILL.md" "$DEST/skills/$name/SKILL.md"
|
|
23
|
+
echo "✓ skill: $name"
|
|
24
|
+
done
|
|
25
|
+
|
|
26
|
+
# 2b) the CLAUDE.md doctrine snippet — copied alongside so npx/pipx users (who never cloned
|
|
27
|
+
# the repo) still have it to paste into ~/.claude/CLAUDE.md.
|
|
28
|
+
if [ -f "$REPO/CLAUDE.md.snippet" ]; then
|
|
29
|
+
install -m 0644 "$REPO/CLAUDE.md.snippet" "$DEST/kijito-claude.CLAUDE.md.snippet"
|
|
30
|
+
echo "✓ doctrine snippet → $DEST/kijito-claude.CLAUDE.md.snippet"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# 3) settings.json — merge statusLine / totalTokensReminder / env / SessionStart hook (idempotent)
|
|
34
|
+
SET="$DEST/settings.json"; [ -f "$SET" ] || echo '{}' > "$SET"
|
|
35
|
+
cp "$SET" "$SET.bak.$(date +%Y%m%d%H%M%S)"
|
|
36
|
+
HOOK=$(jq -n --arg cmd "bash $DEST/session-catchup-hint.sh" \
|
|
37
|
+
'{matcher:"startup|clear|compact", hooks:[{type:"command", command:$cmd}]}')
|
|
38
|
+
jq --arg home "$DEST" --argjson hook "$HOOK" '
|
|
39
|
+
.statusLine = {type:"command", command:("bash " + $home + "/statusline-context.sh"), padding:0}
|
|
40
|
+
| .totalTokensReminder = (.totalTokensReminder // "countdown")
|
|
41
|
+
| .env = ((.env // {}) + {KIJITO_AUTOCATCHUP_DELAY: ((.env.KIJITO_AUTOCATCHUP_DELAY) // "4.0")})
|
|
42
|
+
| .hooks = (.hooks // {})
|
|
43
|
+
| .hooks.SessionStart = (
|
|
44
|
+
((.hooks.SessionStart // [])
|
|
45
|
+
| map(select([ (.hooks[]?.command // "") ] | any(test("session-catchup-hint")) | not)))
|
|
46
|
+
+ [$hook] )
|
|
47
|
+
' "$SET" > "$SET.tmp"
|
|
48
|
+
jq -e . "$SET.tmp" >/dev/null
|
|
49
|
+
mv "$SET.tmp" "$SET"
|
|
50
|
+
echo "✓ settings.json merged (backup: $SET.bak.*)"
|
|
51
|
+
|
|
52
|
+
echo
|
|
53
|
+
echo "Next: add the doctrine snippet to your ~/.claude/CLAUDE.md (context self-check + session-start"
|
|
54
|
+
echo "catch-up + self-clear gate). It's at $DEST/kijito-claude.CLAUDE.md.snippet"
|
|
55
|
+
echo "New sessions pick up the hook + statusline; restart a running session to apply."
|
|
56
|
+
echo "Verify context self-check now: ~/.claude/myctx.sh"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kijito-claude"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Installer for the kijito-claude toolkit — context tracking, session catch-up, and self-clear scripts plus the Kijito skills, deployed into ~/.claude."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
13
|
+
authors = [{ name = "Arcada Labs", email = "jason@arcadalabs.com" }]
|
|
14
|
+
keywords = ["kijito", "claude", "claude-code", "anthropic", "installer", "cli", "skills"]
|
|
15
|
+
dependencies = []
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Operating System :: POSIX",
|
|
21
|
+
"Operating System :: MacOS",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Topic :: Software Development :: Build Tools",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/KijitoAI/kijito-claude"
|
|
29
|
+
Repository = "https://github.com/KijitoAI/kijito-claude"
|
|
30
|
+
"Bug Tracker" = "https://github.com/KijitoAI/kijito-claude/issues"
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
kijito-claude = "kijito_claude.cli:main"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/kijito_claude"]
|
|
37
|
+
|
|
38
|
+
# The bash scripts, skills, install.sh, and the CLAUDE.md snippet live at the repo root so
|
|
39
|
+
# they double as the git-clone install path. Pull them into the wheel under the package so
|
|
40
|
+
# importlib.resources can find them at runtime.
|
|
41
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
42
|
+
"scripts" = "kijito_claude/_assets/scripts"
|
|
43
|
+
"skills" = "kijito_claude/_assets/skills"
|
|
44
|
+
"install.sh" = "kijito_claude/_assets/install.sh"
|
|
45
|
+
"CLAUDE.md.snippet" = "kijito_claude/_assets/CLAUDE.md.snippet"
|
|
46
|
+
|
|
47
|
+
[tool.hatch.build.targets.sdist]
|
|
48
|
+
include = [
|
|
49
|
+
"src/",
|
|
50
|
+
"scripts/",
|
|
51
|
+
"skills/",
|
|
52
|
+
"install.sh",
|
|
53
|
+
"CLAUDE.md.snippet",
|
|
54
|
+
"README.md",
|
|
55
|
+
"LICENSE",
|
|
56
|
+
"NOTICE",
|
|
57
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Turn THIS session's autonomy on/off via INTERACTION. The agent runs this when the user says
|
|
3
|
+
# "enable self-clear" / "go autonomous" (on), or "I'll manage this one" (off). It arms the current
|
|
4
|
+
# tmux PANE: self-clear becomes permitted, and post-/clear SessionStarts auto-catch-up + resume.
|
|
5
|
+
# Same marker claude-armed.sh uses, so launch-time and interaction-time arming are identical.
|
|
6
|
+
. "$HOME/.claude/lifecycle-lib.sh"
|
|
7
|
+
action="${1:-on}"
|
|
8
|
+
if [ -z "${TMUX_PANE:-}" ]; then echo "not in tmux — autonomy needs a tmux pane; nothing armed."; exit 1; fi
|
|
9
|
+
marker="$KIJITO_LC_DIR/arm.$TMUX_PANE"
|
|
10
|
+
case "$action" in
|
|
11
|
+
on) touch "$marker"; lc_log ARM "on pane=$TMUX_PANE"
|
|
12
|
+
echo "AUTONOMY ON (pane $TMUX_PANE): self-clear permitted; after any /clear this pane auto-catches-up + resumes. Turn off: ~/.claude/arm-session.sh off" ;;
|
|
13
|
+
off) rm -f "$marker"; lc_log ARM "off pane=$TMUX_PANE"
|
|
14
|
+
echo "AUTONOMY OFF (pane $TMUX_PANE): human-managed; self-clear refused." ;;
|
|
15
|
+
status) if lc_is_armed "$TMUX_PANE"; then echo "armed (autonomous)"; else echo "not armed (human-managed)"; fi ;;
|
|
16
|
+
*) echo "usage: arm-session.sh [on|off|status]"; exit 2 ;;
|
|
17
|
+
esac
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Launch an ARMED Claude Code session: when in tmux it auto-sends the catch-up prompt (instigating
|
|
3
|
+
# its own first turn) and continues preloaded work. Use for orchestrator/unattended panes + the
|
|
4
|
+
# self-clear loop. Plain `claude` is NOT armed → never collides with you typing.
|
|
5
|
+
#
|
|
6
|
+
# Arming is a per-pane MARKER file (robust; doesn't depend on env reaching the hook). The marker is
|
|
7
|
+
# removed when claude exits (trap). KIJITO_AUTOCATCHUP=1 is also exported as a belt-and-suspenders.
|
|
8
|
+
. "$HOME/.claude/lifecycle-lib.sh" 2>/dev/null
|
|
9
|
+
marker="${KIJITO_LC_DIR:-$HOME/.claude/.lifecycle}/arm.${TMUX_PANE:-nopane}"
|
|
10
|
+
mkdir -p "$(dirname "$marker")" 2>/dev/null
|
|
11
|
+
touch "$marker" 2>/dev/null
|
|
12
|
+
trap 'rm -f "$marker"' EXIT INT TERM
|
|
13
|
+
KIJITO_AUTOCATCHUP=1 claude "$@"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Record that /kijito-qa-memory Phase-4 cold-boot verification PASSED for THIS session.
|
|
3
|
+
# self-clear.sh REQUIRES a fresh token from this before it will fire (gate C1) — i.e. you
|
|
4
|
+
# cannot self-clear without a passing cold-boot verify. The token is consumed by one /clear.
|
|
5
|
+
. "$HOME/.claude/lifecycle-lib.sh"
|
|
6
|
+
lc_now > "$(lc_qa_token)"
|
|
7
|
+
lc_log QA_PASS "cold-boot verified"
|
|
8
|
+
echo "Recorded kijito-qa-memory pass for session ${CLAUDE_CODE_SESSION_ID:-?}. self-clear unlocked for ONE clear."
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Shared helpers for Kijito session-lifecycle scripts. SOURCE this (`. lifecycle-lib.sh`), don't exec.
|
|
3
|
+
KIJITO_LC_DIR="${KIJITO_LC_DIR:-$HOME/.claude/.lifecycle}"
|
|
4
|
+
mkdir -p "$KIJITO_LC_DIR" 2>/dev/null
|
|
5
|
+
KIJITO_LC_LOG="$KIJITO_LC_DIR/lifecycle.log"
|
|
6
|
+
KIJITO_LC_STOP="$KIJITO_LC_DIR/STOP"
|
|
7
|
+
|
|
8
|
+
lc_now() { date +%s; } # epoch (portable BSD/GNU)
|
|
9
|
+
|
|
10
|
+
lc_log() { # M2 — audit log: action [detail]
|
|
11
|
+
printf '%s sid=%s pane=%s %s %s\n' \
|
|
12
|
+
"$(date '+%Y-%m-%dT%H:%M:%S')" "${CLAUDE_CODE_SESSION_ID:-?}" "${TMUX_PANE:-?}" "$1" "${2:-}" \
|
|
13
|
+
>> "$KIJITO_LC_LOG" 2>/dev/null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
lc_stopped() { [ -f "$KIJITO_LC_STOP" ]; } # M1 — kill switch: `touch ~/.claude/.lifecycle/STOP` halts all
|
|
17
|
+
|
|
18
|
+
# C3 — best-effort subagent guard. VERIFIED 2026-06-24: a subagent shares the parent's
|
|
19
|
+
# CLAUDE_CODE_SESSION_ID / CLAUDE_CODE_CHILD_SESSION / ENTRYPOINT, so there is NO reliable env
|
|
20
|
+
# discriminator today. This only trips on FUTURE markers and NEVER false-positives the main
|
|
21
|
+
# session (both are unset now). Real C3 protection = consumable QA token + cycle cap + kill switch.
|
|
22
|
+
lc_is_child() { [ -n "${CLAUDE_AGENT_TYPE:-}" ] || [ -n "${CLAUDE_CODE_AGENT:-}" ]; }
|
|
23
|
+
|
|
24
|
+
lc_pane_alive() { command -v tmux >/dev/null 2>&1 && tmux display-message -p -t "$1" '#{session_name}' >/dev/null 2>&1; }
|
|
25
|
+
|
|
26
|
+
# M4 (FIXED) — a running claude pane reports pane_current_command as its VERSION (e.g. "2.1.190"),
|
|
27
|
+
# NOT "claude"/"node" (verified 2026-06-24). So check "not a bare shell" instead of whitelisting claude.
|
|
28
|
+
lc_pane_usable() {
|
|
29
|
+
[ "${KIJITO_LC_TEST:-0}" = "1" ] && return 0 # test-harness escape hatch
|
|
30
|
+
local c; c=$(tmux display-message -p -t "$1" '#{pane_current_command}' 2>/dev/null)
|
|
31
|
+
case "$c" in ""|zsh|bash|sh|-zsh|-bash|-sh|fish|tcsh|dash) return 1 ;; *) return 0 ;; esac
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# Per-spawn arming (ROBUST — no env-propagation dependency): claude-armed.sh drops a marker keyed to
|
|
35
|
+
# the pane; the hook (which reliably has TMUX_PANE) reads it. Also honors KIJITO_AUTOCATCHUP=1.
|
|
36
|
+
lc_is_armed() { [ -f "$KIJITO_LC_DIR/arm.${1:-${TMUX_PANE:-x}}" ] || [ "${KIJITO_AUTOCATCHUP:-0}" = "1" ]; }
|
|
37
|
+
|
|
38
|
+
# qa-token is SESSION-keyed (correct: each post-/clear session must earn its OWN fresh QA pass).
|
|
39
|
+
lc_qa_token() { echo "$KIJITO_LC_DIR/qa-pass.${CLAUDE_CODE_SESSION_ID:-nosession}"; }
|
|
40
|
+
# cycle/checkpoint are PANE-keyed: /clear ROTATES CLAUDE_CODE_SESSION_ID (verified live: 1c5947c1→
|
|
41
|
+
# 6f305fa1 in the same pane %19), so a session-keyed counter resets every clear and the cap/checkpoint
|
|
42
|
+
# never accumulate across the self-clear loop. The pane persists across clears → accumulate correctly.
|
|
43
|
+
lc_cycle_file() { echo "$KIJITO_LC_DIR/cycles.${TMUX_PANE:-${CLAUDE_CODE_SESSION_ID:-nosession}}"; }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# "How full am I, really?" — hard data vs. gut. Run this when you FEEL full.
|
|
3
|
+
# Bulletproof: finds THIS session's transcript via CLAUDE_CODE_SESSION_ID (no
|
|
4
|
+
# "newest file" guessing), then reads the API's own token ledger (== /context).
|
|
5
|
+
sid="${CLAUDE_CODE_SESSION_ID:?CLAUDE_CODE_SESSION_ID not set}"
|
|
6
|
+
f=$(find ~/.claude/projects -name "$sid.jsonl" 2>/dev/null | head -1)
|
|
7
|
+
[ -z "$f" ] && { echo "no transcript for session $sid"; exit 1; }
|
|
8
|
+
win="${CTX_WINDOW:-1000000}"
|
|
9
|
+
used=$(jq -s 'map(select(.type=="assistant" and .message.usage!=null).message.usage)|last // {}
|
|
10
|
+
|(.input_tokens//0)+(.cache_read_input_tokens//0)+(.cache_creation_input_tokens//0)' "$f")
|
|
11
|
+
awk -v u="$used" -v w="$win" 'BEGIN{
|
|
12
|
+
printf "context: %d tok = %.1f%% of %dk (free: %.1f%%, ~%d tok)\n", u, u/w*100, w/1000, (1-u/w)*100, w-u }'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# AGENT-INVOKED self-/clear — the agent's FINAL action, only after /kijito-qa-memory passed.
|
|
3
|
+
# Hard gates (all must hold): kill-switch off · armed · not-a-subagent · in tmux · pane alive +
|
|
4
|
+
# is claude · FRESH qa-pass token · under cycle cap · not a checkpoint cycle. Never auto-fired.
|
|
5
|
+
set -u
|
|
6
|
+
. "$HOME/.claude/lifecycle-lib.sh"
|
|
7
|
+
refuse(){ echo "self-clear REFUSED: $1" >&2; lc_log SELFCLEAR_REFUSED "$1"; exit "${2:-3}"; }
|
|
8
|
+
|
|
9
|
+
lc_stopped && refuse "kill switch present ($KIJITO_LC_STOP) — rm it to re-enable" 9
|
|
10
|
+
lc_is_armed "${TMUX_PANE:-}" || refuse "not an armed pane — self-clear only runs in autonomous sessions (launch via ~/.claude/claude-armed.sh); plain 'claude' is human-managed" 3
|
|
11
|
+
lc_is_child && refuse "subagent marker set — would clear the PARENT pane" 6
|
|
12
|
+
{ [ -n "${TMUX:-}" ] && [ -n "${TMUX_PANE:-}" ]; } || refuse "not in tmux (TMUX/TMUX_PANE unset)" 4
|
|
13
|
+
lc_pane_alive "$TMUX_PANE" || refuse "target pane $TMUX_PANE no longer exists" 4
|
|
14
|
+
# (no pane_current_command gate — unreliable label; send-keys reaches the TTY regardless)
|
|
15
|
+
|
|
16
|
+
# C1 — require a FRESH /kijito-qa-memory pass for THIS session
|
|
17
|
+
tok="$(lc_qa_token)"; ttl="${KIJITO_QA_TTL:-1800}"
|
|
18
|
+
[ -f "$tok" ] || refuse "no kijito-qa-memory pass — run /kijito-qa-memory first (it cold-boot-verifies, then records the token)" 5
|
|
19
|
+
age=$(( $(lc_now) - $(cat "$tok" 2>/dev/null || echo 0) ))
|
|
20
|
+
[ "$age" -le "$ttl" ] || refuse "kijito-qa-memory pass is stale (${age}s > ${ttl}s) — re-run /kijito-qa-memory" 5
|
|
21
|
+
|
|
22
|
+
# C2 / H3 — cycle cap + periodic human checkpoint (count only genuine fires)
|
|
23
|
+
cf="$(lc_cycle_file)"; cyc=$(( $(cat "$cf" 2>/dev/null || echo 0) + 1 )); echo "$cyc" > "$cf"
|
|
24
|
+
max="${KIJITO_SELFCLEAR_MAX_CYCLES:-12}"
|
|
25
|
+
[ "$cyc" -le "$max" ] || refuse "cycle cap hit ($cyc > $max) — likely a loop; human review (reset: rm $cf)" 7
|
|
26
|
+
chk="${KIJITO_SELFCLEAR_CHECKPOINT:-5}"
|
|
27
|
+
if [ "$chk" -gt 0 ] && [ $(( cyc % chk )) -eq 0 ]; then
|
|
28
|
+
refuse "checkpoint at cycle $cyc (every $chk) — pausing for human review; run again to continue past it" 8
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# C5 — consume the token (one clear per QA pass) and fire as the LAST action
|
|
32
|
+
rm -f "$tok"
|
|
33
|
+
delay="${KIJITO_SELFCLEAR_DELAY:-3.0}"
|
|
34
|
+
lc_log SELFCLEAR_FIRE "cycle=$cyc delay=$delay"
|
|
35
|
+
( sleep "$delay"
|
|
36
|
+
lc_stopped && { lc_log SELFCLEAR_ABORT "stop during delay"; exit 0; }
|
|
37
|
+
lc_pane_alive "$TMUX_PANE" || { lc_log SELFCLEAR_ABORT "pane gone during delay"; exit 0; }
|
|
38
|
+
tmux send-keys -t "$TMUX_PANE" -l -- "/clear" 2>/dev/null
|
|
39
|
+
tmux send-keys -t "$TMUX_PANE" Enter 2>/dev/null
|
|
40
|
+
lc_log SELFCLEAR_DONE "cycle=$cyc"
|
|
41
|
+
) >/dev/null 2>&1 &
|
|
42
|
+
echo "self-clear scheduled (cycle $cyc/$max): /clear → $TMUX_PANE in ${delay}s. This MUST be your FINAL action — stop now; SessionStart re-catches-up and resumes the preloaded work."
|
|
43
|
+
exit 0
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Delayed self-send of the catch-up prompt INTO a tmux pane → instigates the first turn.
|
|
3
|
+
# Called (detached, via nohup &) by the SessionStart hook ONLY when the pane is armed + in tmux.
|
|
4
|
+
# Args: $1 = target tmux pane (normally "$TMUX_PANE"). Fixed-delay approach — proven reliable.
|
|
5
|
+
# Needs Kijito: OPTIONAL — set KIJITO_AUTOCATCHUP_PROMPT for your own text, or KIJITO_MODE=off for a
|
|
6
|
+
# generic (non-Kijito) default prompt.
|
|
7
|
+
set -u
|
|
8
|
+
. "$HOME/.claude/lifecycle-lib.sh"
|
|
9
|
+
pane="${1:?target pane required}"
|
|
10
|
+
command -v tmux >/dev/null 2>&1 || exit 0
|
|
11
|
+
lc_stopped && { lc_log AUTOSEND_SKIP "kill switch"; exit 0; }
|
|
12
|
+
|
|
13
|
+
if [ -n "${KIJITO_AUTOCATCHUP_PROMPT:-}" ]; then
|
|
14
|
+
prompt="$KIJITO_AUTOCATCHUP_PROMPT"
|
|
15
|
+
elif [ "${KIJITO_MODE:-on}" = "off" ]; then
|
|
16
|
+
# standalone (no Kijito): catch up against whatever notes/handoff you keep
|
|
17
|
+
prompt="Catch up on this project's context and any handoff / next-steps notes from the prior session, then CONTINUE the active work to its DONE-WHEN without waiting for further instruction. If there's no active work, report ready."
|
|
18
|
+
else
|
|
19
|
+
prompt="Please catch up deeply on all memories, lessons, and arm your inbox. If you are on a brand-new project with no persona yet, set that up per CLAUDE.md. Then, if your current-state / next-steps pointer shows ACTIVE WORK in progress, CONTINUE it autonomously without waiting for further instruction — work to its DONE-WHEN criteria, stopping only for a genuine gate. If there is no active work to resume, report ready."
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
delay="${KIJITO_AUTOCATCHUP_DELAY:-4.0}" # seconds for the TUI to become input-ready
|
|
23
|
+
sleep "$delay"
|
|
24
|
+
lc_stopped && { lc_log AUTOSEND_ABORT "stop appeared"; exit 0; }
|
|
25
|
+
lc_pane_alive "$pane" || { lc_log AUTOSEND_ABORT "pane gone"; exit 0; }
|
|
26
|
+
# NOTE: do NOT gate on pane_current_command — it's unreliable (reports "bash" for a wrapped
|
|
27
|
+
# claude, the version for an exec'd one). send-keys reaches the pane's TTY (claude) regardless.
|
|
28
|
+
tmux send-keys -t "$pane" -l -- "$prompt" 2>/dev/null
|
|
29
|
+
tmux send-keys -t "$pane" Enter 2>/dev/null
|
|
30
|
+
lc_log AUTOSEND_FIRE "delay=$delay"
|
|
31
|
+
exit 0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SessionStart hook → (1) ALWAYS print a passive catch-up reminder (additionalContext via stdout),
|
|
3
|
+
# (2) ARMED auto-send: if this pane is armed (claude-armed.sh marker or KIJITO_AUTOCATCHUP=1) and
|
|
4
|
+
# we're in tmux, instigate the first turn by typing the prompt into our own pane.
|
|
5
|
+
. "$HOME/.claude/lifecycle-lib.sh" 2>/dev/null
|
|
6
|
+
src=$(cat 2>/dev/null | jq -r '.source // "startup"' 2>/dev/null); [ -z "$src" ] && src=startup
|
|
7
|
+
case "$src" in
|
|
8
|
+
clear) pre="You just /clear'd — context was intentionally reset to a clean slate." ;;
|
|
9
|
+
compact) pre="Context was just compacted — detail was summarized away; memory is now the source of truth." ;;
|
|
10
|
+
*) pre="New session." ;;
|
|
11
|
+
esac
|
|
12
|
+
cat <<EOF
|
|
13
|
+
[SESSION CATCH-UP — do this BEFORE the user's task] $pre Start continuous, not cold:
|
|
14
|
+
1) kijito_startup(persona, project) → read the current-state pointer it names (kijito_get) → skim recent lessons.
|
|
15
|
+
2) Arm your inbox watcher.
|
|
16
|
+
3) If this is a BRAND-NEW project with NO persona yet: read ./CLAUDE.md + ~/.claude/CLAUDE.md and set your persona/project before writing any memory.
|
|
17
|
+
Never pause on a *feeling* of full context — run ~/.claude/myctx.sh for hard data.
|
|
18
|
+
EOF
|
|
19
|
+
|
|
20
|
+
# Armed auto-send (detached so it never blocks startup or pollutes the additionalContext above).
|
|
21
|
+
if command -v lc_is_armed >/dev/null 2>&1 && [ -n "${TMUX:-}" ] && [ -n "${TMUX_PANE:-}" ] && lc_is_armed "$TMUX_PANE"; then
|
|
22
|
+
lc_log HOOK "src=$src autosend=ARMED pane=$TMUX_PANE"
|
|
23
|
+
nohup bash "$HOME/.claude/session-autosend.sh" "$TMUX_PANE" >/dev/null 2>&1 &
|
|
24
|
+
else
|
|
25
|
+
command -v lc_log >/dev/null 2>&1 && lc_log HOOK "src=$src autosend=skip(not-armed-or-no-tmux) tmux=${TMUX:+y} pane=${TMUX_PANE:-none}"
|
|
26
|
+
fi
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Claude Code statusline — model name + accurate context-window usage.
|
|
3
|
+
# Source of truth, in order:
|
|
4
|
+
# 1) harness-provided context_window.* fields (if this CC version supplies them)
|
|
5
|
+
# 2) fallback: compute from the transcript's API usage ledger — the same data
|
|
6
|
+
# /context is built on (sum input+cache_read+cache_creation of last asst turn).
|
|
7
|
+
# Reads the statusline JSON on stdin; prints one line. ~tens of ms; never enters the model's context.
|
|
8
|
+
input=$(cat)
|
|
9
|
+
|
|
10
|
+
model=$(printf '%s' "$input" | jq -r '.model.display_name // "Claude"')
|
|
11
|
+
|
|
12
|
+
# 1) Prefer harness-computed context window if present
|
|
13
|
+
used=$(printf '%s' "$input" | jq -r '.context_window.used_tokens // empty')
|
|
14
|
+
win=$(printf '%s' "$input" | jq -r '.context_window.total_tokens // empty')
|
|
15
|
+
|
|
16
|
+
# 2) Fallback: ground-truth from the transcript usage ledger
|
|
17
|
+
if [ -z "$used" ]; then
|
|
18
|
+
tp=$(printf '%s' "$input" | jq -r '.transcript_path // empty')
|
|
19
|
+
if [ -n "$tp" ] && [ -f "$tp" ]; then
|
|
20
|
+
used=$(jq -s 'map(select(.type=="assistant" and .message.usage != null) | .message.usage) | last // {}
|
|
21
|
+
| (.input_tokens // 0) + (.cache_read_input_tokens // 0) + (.cache_creation_input_tokens // 0)' \
|
|
22
|
+
"$tp" 2>/dev/null)
|
|
23
|
+
fi
|
|
24
|
+
fi
|
|
25
|
+
[ -z "$used" ] && used=0
|
|
26
|
+
[ -z "$win" ] && win=1000000
|
|
27
|
+
|
|
28
|
+
pct=$(awk -v u="$used" -v w="$win" 'BEGIN { if (w>0) printf "%.0f", (u/w)*100; else print 0 }')
|
|
29
|
+
uk=$(awk -v u="$used" 'BEGIN { if (u>=1000) printf "%.0fk", u/1000; else printf "%d", u }')
|
|
30
|
+
wk=$(awk -v w="$win" 'BEGIN { if (w>=1000000) printf "%gm", w/1000000; else printf "%.0fk", w/1000 }')
|
|
31
|
+
|
|
32
|
+
# refresh-before-70 discipline: green <60, yellow 60-79, red >=80
|
|
33
|
+
col=$(awk -v p="$pct" 'BEGIN { if (p>=80) printf "\033[31m"; else if (p>=60) printf "\033[33m"; else printf "\033[32m" }')
|
|
34
|
+
printf '%s · ctx %b%s/%s (%s%%)\033[0m' "$model" "$col" "$uk" "$wk" "$pct"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kijito-qa-memory
|
|
3
|
+
description: Rigorous Kijito memory curation with enforced creation + cold-boot verification. Use when winding down a session, before /clear or self-clear, when asked to "QA / curate / clean up memory", when preparing a handoff for the next session, or any time you need to be sure a fresh session could continue the work. Counters the two chronic failure modes — treating "QA" as corrections-only (skipping creation), and never confirming the memory actually works in a cold context.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kijito QA Memory — curate the graph, then PROVE it works cold
|
|
7
|
+
|
|
8
|
+
Kijito (local daemon, `mcp__kijito__*`) is the only thing that survives a `/clear` or a new session. "QA memory" is not "fix a few wrong notes" — it is **make the graph match what this session actually learned, then confirm a cold agent can act on it.** Pass your persona/project on every write.
|
|
9
|
+
|
|
10
|
+
## The bias this skill exists to defeat
|
|
11
|
+
|
|
12
|
+
You will, by default, do two wrong things — counteract both deliberately:
|
|
13
|
+
1. **Collapse QA to corrections-only.** The creation gap is *invisible* (you can't see the memory you never wrote), so "QA" silently becomes "tidy existing notes." **Creation is half the job and it is the half that gets skipped. Do it FIRST and exhaustively.**
|
|
14
|
+
2. **Assume done instead of confirming.** You'll declare the handoff good without ever testing it cold. **A curation is not complete until a fresh, context-free agent reconstructs the work from memory alone.** This is non-negotiable and is the step you'll be tempted to skip.
|
|
15
|
+
|
|
16
|
+
Run the phases in order. Do not declare done until Phase 4 passes twice (2-green).
|
|
17
|
+
|
|
18
|
+
## Phase 1 — CREATE (exhaustive, do this FIRST)
|
|
19
|
+
|
|
20
|
+
Enumerate EVERY candidate insight from this session — don't filter yet:
|
|
21
|
+
- decisions made · findings/results · bugs found · lessons & gotchas · reusable recipes/commands · state changes · things you now believe that you didn't before · corrections to prior belief.
|
|
22
|
+
|
|
23
|
+
For each candidate ask: **"Is this already an atomic memory?"** If not, write it now:
|
|
24
|
+
- one insight per memory (if you wrote "5 things about X", that's 5 memories);
|
|
25
|
+
- front-load the exact words a later search/teammate would use;
|
|
26
|
+
- set `persona` + `project`; pick honest `importance` (don't inflate; 0.85+ never decays).
|
|
27
|
+
|
|
28
|
+
Then apply the **completeness gate**, out loud: *"What did I learn this session that is NOT yet written?"* — and EXPECT to find gaps. List them, write them. Only move on when that question returns nothing.
|
|
29
|
+
|
|
30
|
+
## Phase 2 — CORRECT / STALENESS
|
|
31
|
+
|
|
32
|
+
`kijito_recall` each topic you touched this session. For every memory that is now **wrong or changed** → `kijito_correct` (fades old + links the fix; never edit history). **Obsolete** → `kijito_fade`. Operational/"how X works" memories are the most dangerous when stale — verify against reality (code/config/files) before trusting or correcting.
|
|
33
|
+
|
|
34
|
+
## Phase 3 — PRELOAD THE HANDOFF (the current-state pointer)
|
|
35
|
+
|
|
36
|
+
Update your living current-state / next-steps pointer (e.g. a stable memory you `kijito_update` in place) so it ALONE drives the next session:
|
|
37
|
+
- **OPEN with an imperative to continue** — `RESUME NOW: <next concrete action>` — not a description, or the next session asks "what should I work on?" instead of acting.
|
|
38
|
+
- then: the single active task · exact next steps · DONE-WHEN criteria · key anchor memory IDs.
|
|
39
|
+
- if **no pointer exists yet** (new persona/project), CREATE one as a stable memory and record its ID — that is your pointer from now on (a cold boot has nothing to read otherwise).
|
|
40
|
+
- if the work is **DONE** (DONE-WHEN met), do NOT write `RESUME NOW` — mark it COMPLETE so the next boot reports done. A stale imperative on finished work causes an infinite self-clear loop.
|
|
41
|
+
- if self-managing an **autonomous workstream**, `kijito_hive_claim` it first so a concurrent same-persona session can't clobber the handoff; release when done.
|
|
42
|
+
|
|
43
|
+
## Phase 4 — COLD-BOOT VERIFY (confirm, don't assume — DO NOT SKIP)
|
|
44
|
+
|
|
45
|
+
Prove the memory works in a context that has never seen this conversation. Spawn a **fresh general-purpose subagent** (NOT a fork — a fork inherits your context and would cheat the test). Give it only this:
|
|
46
|
+
|
|
47
|
+
> You are a brand-new session. Connect to Kijito and cold-boot: `kijito_startup(persona="<P>", project="<J>")`, then read the current-state pointer it names and the memories it links. Using ONLY what Kijito returns (you have no other context), report:
|
|
48
|
+
> 1. the single active task in progress,
|
|
49
|
+
> 2. the exact next step to take right now,
|
|
50
|
+
> 3. what is already done vs. not,
|
|
51
|
+
> 4. the DONE-WHEN criteria,
|
|
52
|
+
> 5. anything ambiguous, missing, or contradictory.
|
|
53
|
+
> Do not guess or infer beyond what the memories say — if it isn't in memory, report it as a GAP.
|
|
54
|
+
|
|
55
|
+
Compare its report to ground truth:
|
|
56
|
+
- Reconstructs task + next step + DONE-WHEN correctly, no load-bearing gaps → **PASS**.
|
|
57
|
+
- Misses, garbles, or flags a real gap → **FAIL**: that gap is a missing/weak memory → go back to **Phase 1/3**, fix the *specific* gap, re-run.
|
|
58
|
+
|
|
59
|
+
**2-green:** repeat Phase 4 until two consecutive cold boots reconstruct cleanly. Finding any issue resets the count.
|
|
60
|
+
|
|
61
|
+
## Done report
|
|
62
|
+
|
|
63
|
+
State plainly: N memories created, N corrected, N faded; the current-state pointer ID; and the cold-boot verdict ("a fresh agent reconstructed the active task + next steps + DONE-WHEN, 2 consecutive clean boots"). If you cannot say that, you are not done.
|
|
64
|
+
|
|
65
|
+
**Then record the pass:** run `~/.claude/kijito-qa-pass.sh`. This writes the token `self-clear.sh` requires — without a passing cold-boot verify you cannot self-clear, by design. The token is consumed by one `/clear`, so each recycle needs a fresh kijito-qa-memory pass.
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
|
|
69
|
+
- This skill IS the memory half of the self-clear gate: a session may only self-`/clear` after this passes (then the next session resumes from the pointer).
|
|
70
|
+
- Reproducible from Kijito: the procedure is also stored in the graph — `kijito_recall("kijito-qa-memory skill procedure cold-boot verify")` — so any agent on any machine can recover or rebuild it even without this file.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kijito-start
|
|
3
|
+
description: Catch up at the start of a session so you continue rather than restart. For an existing persona — load memory, read the current-state pointer and recent lessons, arm the inbox, and resume any active work. For a brand-new persona/project — establish identity from CLAUDE.md, set up the inbox, and create the current-state pointer. Use on the first action of a session, after a /clear, or after compaction. Optional: this is a handful of tool calls you can run by hand; the skill just makes the routine uniform and one command.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kijito Start — begin continuous, not cold
|
|
7
|
+
|
|
8
|
+
Every session begins in the middle of ongoing work, not from zero. Kijito (local daemon, `mcp__kijito__*`) holds what the last session learned; this skill loads it before you touch the user's task, so you act on accumulated context instead of guessing.
|
|
9
|
+
|
|
10
|
+
**This is optional.** The catch-up is just a few Kijito calls — `kijito_startup`, a couple of `kijito_get`s, an inbox check — and you can do them by hand any time. The skill exists because it is easy to deploy and runs the same way every session, not because the steps are hard. A SessionStart hook can also remind you passively; this skill is the active, thorough version.
|
|
11
|
+
|
|
12
|
+
## Phase 0 — which branch are you on?
|
|
13
|
+
|
|
14
|
+
Run `kijito_startup(persona="<P>", project="<J>")` with the persona/project your `CLAUDE.md` assigns (project `CLAUDE.md` first, then `~/.claude/CLAUDE.md`). Pass them explicitly; do not rely on auto-discovery.
|
|
15
|
+
|
|
16
|
+
- It returns identity + recall + recent + goals, and reports whether your persona already exists.
|
|
17
|
+
- **Existing persona** (has memories, an identity, a current-state pointer) → **Path A**.
|
|
18
|
+
- **Brand-new persona/project** (no identity memory, empty inbox, nothing to resume) → **Path B**.
|
|
19
|
+
|
|
20
|
+
## Path A — existing persona: catch up deeply, then resume
|
|
21
|
+
|
|
22
|
+
1. **Read the pointer in full.** `kijito_startup` truncates content. `kijito_get` the current-state / next-steps pointer it names, then `kijito_get` the memories that pointer links. Do not work from previews — the load-bearing detail is in the full text.
|
|
23
|
+
2. **Skim recent lessons.** `kijito_recent` (last 24–48h) and `kijito_recall("lessons gotchas <your project>")`. These are how you avoid repeating a mistake the last session already paid for.
|
|
24
|
+
3. **Distrust stale operational facts.** Memories about how something works (paths, ports, config, deploy steps) are the ones most often wrong after time passes — recall flags them as stale. Verify a load-bearing one against reality (code / config / a quick command) before you act on it.
|
|
25
|
+
4. **Arm your inbox.** Check `kijito_hive_inbox(persona="<P>")` for durable messages from sibling personas. If the inbox monitor runs here, also tail your own stream for live events (`~/.cache/kijito-inbox-monitor/events.<P>.ndjson`); do not start your own watcher if a supervised producer already runs.
|
|
26
|
+
5. **Resume or report.** If the pointer shows ACTIVE WORK and you were auto-started on an armed pane, continue it autonomously to its DONE-WHEN — do not wait for a prompt. Otherwise, report where things stand and wait for the user.
|
|
27
|
+
|
|
28
|
+
## Path B — brand-new persona/project: set up identity first
|
|
29
|
+
|
|
30
|
+
Do this **before writing any memory**, or the first writes land under the wrong owner and contaminate the graph.
|
|
31
|
+
|
|
32
|
+
1. **Read the briefs.** Project `./CLAUDE.md` and `~/.claude/CLAUDE.md` — they tell you who you are here (persona, project, the rules of this codebase).
|
|
33
|
+
2. **Fix the wiring if needed.** If `mcp__kijito__*` tools are absent, the project is missing `.mcp.json` (server `kijito` → `http://127.0.0.1:7474/mcp/`, type `http`) and `.claude/settings.local.json` (`"enableAllProjectMcpServers": true`). Add them; new MCP tools load only on a fresh launch.
|
|
34
|
+
3. **Write the identity memory.** One memory establishing persona + project + what this work is. Pass `persona` + `project` on it (and on every write after).
|
|
35
|
+
4. **Open the inbox.** The first `kijito_hive_inbox(persona="<P>")` provisions the inbox; a brand-new persona just gets an empty one (not an error).
|
|
36
|
+
5. **Create the current-state pointer.** A stable memory you will `kijito_update` in place going forward — record its ID. A cold boot has nothing to read otherwise. Open it with the active task and next step (or "no active work yet" if you are only setting up).
|
|
37
|
+
6. **Report ready.**
|
|
38
|
+
|
|
39
|
+
## Failure modes to counter
|
|
40
|
+
|
|
41
|
+
- **Skimming the pointer.** Truncated previews read fine and mislead; `kijito_get` the full text of the pointer and its linked memories.
|
|
42
|
+
- **Skipping the inbox.** A sibling persona may have handed you something or be blocked on you. Always check.
|
|
43
|
+
- **Wrong-owner writes (new personas).** Set persona/project before the first write. `personal` / a mismatched name pollutes recall and is rejected on later edits.
|
|
44
|
+
- **Acting on a stale operational fact.** Verify how-it-works memories against the real system before trusting them.
|
|
45
|
+
|
|
46
|
+
## Done report
|
|
47
|
+
|
|
48
|
+
State plainly: which branch you took; the persona/project; the current-state pointer ID; what the pointer says is active (or that there is none); whether the inbox had anything; and whether you are resuming work or waiting. If a fresh read could not tell what to do next, the pointer is too thin — fix it now with `/kijito-qa-memory` rather than leaving the next session to guess.
|
|
49
|
+
|
|
50
|
+
## Notes
|
|
51
|
+
|
|
52
|
+
- Reproducible from Kijito: the routine is also stored in the graph — `kijito_recall("session start catch-up routine arm inbox")` — so any agent can recover it without this file.
|
|
53
|
+
- Pairs with `/kijito-qa-memory`: that one curates and preloads the handoff at the END of a session; this one consumes that handoff at the START. Together they make a session continuous across `/clear`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Console entry point: run the bundled bash installer (install.sh).
|
|
2
|
+
|
|
3
|
+
The bash scripts and skills are shipped as package data under ``_assets/``. We locate
|
|
4
|
+
them through ``importlib.resources`` (works whether the package is installed normally or
|
|
5
|
+
run via ``pipx run``) and shell out to ``bash``. ``install.sh`` resolves its siblings
|
|
6
|
+
relative to its own directory, so we run it with ``cwd`` set to the assets directory.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import importlib.resources as resources
|
|
12
|
+
import shutil
|
|
13
|
+
import subprocess
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main() -> int:
|
|
18
|
+
bash = shutil.which("bash")
|
|
19
|
+
if bash is None:
|
|
20
|
+
sys.stderr.write(
|
|
21
|
+
"kijito-claude needs bash to run its installer.\n"
|
|
22
|
+
"On Windows, run it inside WSL (recommended) or Git Bash.\n"
|
|
23
|
+
"See https://github.com/KijitoAI/kijito-claude#platform-support\n"
|
|
24
|
+
)
|
|
25
|
+
return 1
|
|
26
|
+
|
|
27
|
+
# For a normally installed wheel (pip/pipx unpack to disk) this is a real path and its
|
|
28
|
+
# siblings (scripts/, skills/) are present next to install.sh.
|
|
29
|
+
assets = resources.files("kijito_claude").joinpath("_assets")
|
|
30
|
+
install_sh = assets.joinpath("install.sh")
|
|
31
|
+
return subprocess.call(
|
|
32
|
+
[bash, str(install_sh), *sys.argv[1:]],
|
|
33
|
+
cwd=str(assets),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
raise SystemExit(main())
|