@smilintux/skcapstone 0.2.6 → 0.3.2
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 +61 -0
- package/docs/CUSTOM_AGENT.md +184 -0
- package/docs/GETTING_STARTED.md +3 -0
- package/openclaw-plugin/src/index.ts +75 -4
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/archive-sessions.sh +72 -0
- package/scripts/install.ps1 +2 -1
- package/scripts/install.sh +2 -1
- package/scripts/nvidia-proxy.mjs +727 -0
- package/scripts/telegram-catchup-all.sh +136 -0
- package/src/skcapstone/__init__.py +70 -1
- package/src/skcapstone/agent_card.py +4 -1
- package/src/skcapstone/blueprint_registry.py +78 -0
- package/src/skcapstone/blueprints/builtins/itil-operations.yaml +40 -0
- package/src/skcapstone/cli/__init__.py +2 -0
- package/src/skcapstone/cli/_common.py +5 -5
- package/src/skcapstone/cli/card.py +36 -5
- package/src/skcapstone/cli/config_cmd.py +53 -1
- package/src/skcapstone/cli/itil.py +434 -0
- package/src/skcapstone/cli/peer.py +3 -1
- package/src/skcapstone/cli/peers_dir.py +3 -1
- package/src/skcapstone/cli/preflight_cmd.py +4 -0
- package/src/skcapstone/cli/skills_cmd.py +120 -24
- package/src/skcapstone/cli/soul.py +47 -24
- package/src/skcapstone/cli/status.py +17 -11
- package/src/skcapstone/cli/usage_cmd.py +7 -2
- package/src/skcapstone/consciousness_config.py +27 -0
- package/src/skcapstone/coordination.py +1 -0
- package/src/skcapstone/daemon.py +28 -9
- package/src/skcapstone/defaults/lumina/manifest.json +1 -1
- package/src/skcapstone/doctor.py +115 -0
- package/src/skcapstone/dreaming.py +761 -0
- package/src/skcapstone/itil.py +1104 -0
- package/src/skcapstone/mcp_server.py +258 -0
- package/src/skcapstone/mcp_tools/__init__.py +2 -0
- package/src/skcapstone/mcp_tools/gtd_tools.py +1 -1
- package/src/skcapstone/mcp_tools/itil_tools.py +657 -0
- package/src/skcapstone/mcp_tools/notification_tools.py +12 -11
- package/src/skcapstone/notifications.py +40 -27
- package/src/skcapstone/onboard.py +46 -0
- package/src/skcapstone/pillars/sync.py +11 -4
- package/src/skcapstone/register.py +8 -0
- package/src/skcapstone/scheduled_tasks.py +107 -0
- package/src/skcapstone/service_health.py +81 -2
- package/src/skcapstone/soul.py +19 -0
- package/systemd/skcapstone.service +5 -6
package/README.md
CHANGED
|
@@ -165,6 +165,66 @@ skcapstone status
|
|
|
165
165
|
|
|
166
166
|
---
|
|
167
167
|
|
|
168
|
+
## Windows Quickstart
|
|
169
|
+
|
|
170
|
+
SKCapstone runs natively on Windows. The installer creates a virtualenv at `%LOCALAPPDATA%\skenv` and adds its `Scripts` directory to your user PATH.
|
|
171
|
+
|
|
172
|
+
### Prerequisites
|
|
173
|
+
|
|
174
|
+
- **Python 3.10+** — [python.org/downloads](https://www.python.org/downloads/) (check "Add to PATH" during install)
|
|
175
|
+
- **Git for Windows** — [git-scm.com](https://git-scm.com/download/win)
|
|
176
|
+
- **Syncthing** (optional) — for cross-device sync ([syncthing.net](https://syncthing.net/downloads/))
|
|
177
|
+
|
|
178
|
+
### Install
|
|
179
|
+
|
|
180
|
+
```powershell
|
|
181
|
+
# Clone and install (creates %LOCALAPPDATA%\skenv venv)
|
|
182
|
+
git clone https://github.com/smilintux-org/skcapstone.git
|
|
183
|
+
cd skcapstone
|
|
184
|
+
.\scripts\install.ps1
|
|
185
|
+
|
|
186
|
+
# The installer adds %LOCALAPPDATA%\skenv\Scripts to your user PATH.
|
|
187
|
+
# Restart your terminal for PATH changes to take effect.
|
|
188
|
+
|
|
189
|
+
# Initialize your agent
|
|
190
|
+
skcapstone init --name "YourAgent"
|
|
191
|
+
|
|
192
|
+
# Check status
|
|
193
|
+
skcapstone status
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Syncthing Sync (Optional)
|
|
197
|
+
|
|
198
|
+
To sync your agent across devices (e.g., Windows desktop + Linux server):
|
|
199
|
+
|
|
200
|
+
1. Install [Syncthing](https://syncthing.net/downloads/) on both machines
|
|
201
|
+
2. Share the `%USERPROFILE%\.skcapstone` folder between devices
|
|
202
|
+
3. Agent state (memories, identity, trust, seeds) syncs automatically
|
|
203
|
+
|
|
204
|
+
### OpenClaw Integration
|
|
205
|
+
|
|
206
|
+
If you're running [OpenClaw](https://github.com/smilintux-org/openclaw), the SK* plugins register automatically during install:
|
|
207
|
+
|
|
208
|
+
```powershell
|
|
209
|
+
# Re-register if needed
|
|
210
|
+
skcapstone register
|
|
211
|
+
|
|
212
|
+
# Verify plugins are loaded in OpenClaw
|
|
213
|
+
# Plugins provide tools for status, rehydration, coordination,
|
|
214
|
+
# soul management, and agent profiles directly in OpenClaw agents.
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Task Scheduler (Background Service)
|
|
218
|
+
|
|
219
|
+
On Windows, the daemon runs via Task Scheduler instead of systemd:
|
|
220
|
+
|
|
221
|
+
```powershell
|
|
222
|
+
# Install the scheduled task (runs at logon)
|
|
223
|
+
.\scripts\windows\install-tasks.ps1
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
168
228
|
## DID Tools
|
|
169
229
|
|
|
170
230
|
SKCapstone exposes a set of **Decentralized Identifier (DID)** MCP tools for sovereign identity management. These tools are available to Claude Code and other MCP clients through the `mcp_tools/did_tools.py` module.
|
|
@@ -223,6 +283,7 @@ DIDs are organized in three tiers of trust and discoverability:
|
|
|
223
283
|
| **SKComm** | Communication — Encrypted channels between agents |
|
|
224
284
|
| **SKChat** | Chat — AI-native encrypted messaging |
|
|
225
285
|
| **SKForge** | Generation — Blueprint creation with agent context |
|
|
286
|
+
| **SKSeed** | Epistemic rigor — Steel man collider, truth alignment, memory audit |
|
|
226
287
|
| **SKStacks** | Infrastructure — Self-hosted deployment patterns |
|
|
227
288
|
|
|
228
289
|
---
|
package/docs/CUSTOM_AGENT.md
CHANGED
|
@@ -161,6 +161,190 @@ sed -i 's/lumina/nova/g' ~/.skcapstone/agents/nova/config/skmemory.yaml
|
|
|
161
161
|
skcapstone soul status --agent nova
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
+
## Configuring Client Tools for Multi-Agent
|
|
165
|
+
|
|
166
|
+
Once you've created your agent, you need to configure your AI client tools
|
|
167
|
+
(Claude Code, Claude Desktop, Cursor, OpenClaw, etc.) so they connect MCP
|
|
168
|
+
servers to the correct agent profile.
|
|
169
|
+
|
|
170
|
+
### The Key: `SKCAPSTONE_AGENT` Environment Variable
|
|
171
|
+
|
|
172
|
+
All SK\* MCP servers read `SKCAPSTONE_AGENT` from their environment to
|
|
173
|
+
determine which agent profile to load. If unset, they default to `lumina`.
|
|
174
|
+
|
|
175
|
+
The priority chain (highest wins):
|
|
176
|
+
|
|
177
|
+
1. `SKMEMORY_AGENT` — skmemory-specific override (rarely needed)
|
|
178
|
+
2. `SKCAPSTONE_AGENT` — universal, used by all SK\* packages
|
|
179
|
+
3. Falls back to `"lumina"`
|
|
180
|
+
|
|
181
|
+
### Claude Code (`~/.claude/mcp.json`)
|
|
182
|
+
|
|
183
|
+
**Do NOT hardcode the agent name in the MCP config.** MCP servers inherit
|
|
184
|
+
environment variables from the parent process, so if you launch Claude Code
|
|
185
|
+
with `SKCAPSTONE_AGENT` set, all servers pick it up automatically.
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"mcpServers": {
|
|
190
|
+
"skmemory": {
|
|
191
|
+
"command": "/home/you/.skenv/bin/skmemory-mcp",
|
|
192
|
+
"args": []
|
|
193
|
+
},
|
|
194
|
+
"skcapstone": {
|
|
195
|
+
"command": "skcapstone-mcp",
|
|
196
|
+
"args": []
|
|
197
|
+
},
|
|
198
|
+
"skcomm": {
|
|
199
|
+
"command": "/home/you/.skenv/bin/skcomm-mcp",
|
|
200
|
+
"args": []
|
|
201
|
+
},
|
|
202
|
+
"skchat": {
|
|
203
|
+
"command": "/home/you/.skenv/bin/skchat-mcp",
|
|
204
|
+
"args": []
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Notice: **no `env` blocks with `SKCAPSTONE_AGENT`**. This is intentional.
|
|
211
|
+
The servers inherit the variable from the shell.
|
|
212
|
+
|
|
213
|
+
Then launch as any agent:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Default (lumina)
|
|
217
|
+
claude
|
|
218
|
+
|
|
219
|
+
# As Jarvis
|
|
220
|
+
SKCAPSTONE_AGENT=jarvis claude
|
|
221
|
+
|
|
222
|
+
# As a custom agent
|
|
223
|
+
SKCAPSTONE_AGENT=nova claude
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Anti-pattern — do NOT do this:**
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"skmemory": {
|
|
231
|
+
"command": "/home/you/.skenv/bin/skmemory-mcp",
|
|
232
|
+
"args": [],
|
|
233
|
+
"env": {
|
|
234
|
+
"SKCAPSTONE_AGENT": "lumina"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Hardcoding the agent name in `env` locks every session to that agent,
|
|
241
|
+
regardless of what you pass on the command line.
|
|
242
|
+
|
|
243
|
+
### Claude Desktop (`claude_desktop_config.json`)
|
|
244
|
+
|
|
245
|
+
Same principle — omit `SKCAPSTONE_AGENT` from the `env` block if you want
|
|
246
|
+
it inherited from the parent process. If Claude Desktop doesn't propagate
|
|
247
|
+
env vars from the shell, you can set it explicitly per config:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"mcpServers": {
|
|
252
|
+
"skcapstone": {
|
|
253
|
+
"command": "skcapstone-mcp",
|
|
254
|
+
"args": [],
|
|
255
|
+
"env": {
|
|
256
|
+
"SKCAPSTONE_AGENT": "jarvis"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Cursor (`.cursor/mcp.json`)
|
|
264
|
+
|
|
265
|
+
Works the same as Claude Code. Place the config at project root or
|
|
266
|
+
`~/.cursor/mcp.json`:
|
|
267
|
+
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"mcpServers": {
|
|
271
|
+
"skcapstone": {
|
|
272
|
+
"command": "skcapstone-mcp",
|
|
273
|
+
"args": []
|
|
274
|
+
},
|
|
275
|
+
"skmemory": {
|
|
276
|
+
"command": "/home/you/.skenv/bin/skmemory-mcp",
|
|
277
|
+
"args": []
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### OpenClaw (`~/.openclaw/openclaw.json`)
|
|
284
|
+
|
|
285
|
+
OpenClaw plugins read `SKCAPSTONE_AGENT` from the environment at startup.
|
|
286
|
+
Set it before launching:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
SKCAPSTONE_AGENT=nova openclaw
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Or set it in your shell profile for a persistent default:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# ~/.bashrc or ~/.zshrc
|
|
296
|
+
export SKCAPSTONE_AGENT=lumina
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Shell Aliases (Convenience)
|
|
300
|
+
|
|
301
|
+
Add these to `~/.bashrc` or `~/.zshrc` for quick agent switching:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Launch Claude Code as different agents
|
|
305
|
+
alias claude-lumina='SKCAPSTONE_AGENT=lumina claude'
|
|
306
|
+
alias claude-jarvis='SKCAPSTONE_AGENT=jarvis claude'
|
|
307
|
+
alias claude-opus='SKCAPSTONE_AGENT=opus claude'
|
|
308
|
+
alias claude-nova='SKCAPSTONE_AGENT=nova claude'
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### systemd Services
|
|
312
|
+
|
|
313
|
+
For background daemons, set the agent via the templated service unit:
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Uses SKCAPSTONE_AGENT=%i from the unit template
|
|
317
|
+
systemctl --user start skcapstone@jarvis
|
|
318
|
+
systemctl --user start skcapstone@nova
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Or set it in a non-templated service:
|
|
322
|
+
|
|
323
|
+
```ini
|
|
324
|
+
[Service]
|
|
325
|
+
Environment=SKCAPSTONE_AGENT=jarvis
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Verifying Your Agent
|
|
329
|
+
|
|
330
|
+
After launching, confirm which agent is active:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
# In the terminal
|
|
334
|
+
echo $SKCAPSTONE_AGENT
|
|
335
|
+
|
|
336
|
+
# Via the CLI
|
|
337
|
+
skcapstone status
|
|
338
|
+
|
|
339
|
+
# Via skmemory
|
|
340
|
+
skmemory ritual --dry-run
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
In Claude Code, ask the agent to run `echo $SKCAPSTONE_AGENT` to confirm
|
|
344
|
+
the MCP servers loaded the correct profile.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
164
348
|
## Tips
|
|
165
349
|
|
|
166
350
|
- The `system_prompt` in `base.json` is the most impactful field — it defines how
|
package/docs/GETTING_STARTED.md
CHANGED
|
@@ -714,6 +714,9 @@ Configure your MCP client to connect via stdio. In Claude Desktop:
|
|
|
714
714
|
}
|
|
715
715
|
```
|
|
716
716
|
|
|
717
|
+
For multi-agent setups (running different agent profiles in different
|
|
718
|
+
sessions), see [Configuring Client Tools for Multi-Agent](CUSTOM_AGENT.md#configuring-client-tools-for-multi-agent).
|
|
719
|
+
|
|
717
720
|
### Join the coordination board
|
|
718
721
|
|
|
719
722
|
If you're working in a multi-agent team:
|
|
@@ -16,16 +16,28 @@ const SKCAPSTONE_BIN = process.env.SKCAPSTONE_BIN || "skcapstone";
|
|
|
16
16
|
const SKMEMORY_BIN = process.env.SKMEMORY_BIN || "skmemory";
|
|
17
17
|
const SKCAPSTONE_AGENT = process.env.SKCAPSTONE_AGENT || "lumina";
|
|
18
18
|
const EXEC_TIMEOUT = 60_000;
|
|
19
|
+
const IS_WIN = process.platform === "win32";
|
|
19
20
|
|
|
20
|
-
function
|
|
21
|
+
function skenvPath(): string {
|
|
22
|
+
if (IS_WIN) {
|
|
23
|
+
const local = process.env.LOCALAPPDATA || "";
|
|
24
|
+
return `${local}\\skenv\\Scripts`;
|
|
25
|
+
}
|
|
26
|
+
const home = process.env.HOME || "";
|
|
27
|
+
return `${home}/.local/bin:${home}/.skenv/bin`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function runCli(bin: string, args: string, agentOverride?: string): { ok: boolean; output: string } {
|
|
31
|
+
const sep = IS_WIN ? ";" : ":";
|
|
32
|
+
const agent = agentOverride || SKCAPSTONE_AGENT;
|
|
21
33
|
try {
|
|
22
34
|
const raw = execSync(`${bin} ${args}`, {
|
|
23
35
|
encoding: "utf-8",
|
|
24
36
|
timeout: EXEC_TIMEOUT,
|
|
25
37
|
env: {
|
|
26
38
|
...process.env,
|
|
27
|
-
SKCAPSTONE_AGENT,
|
|
28
|
-
PATH: `${
|
|
39
|
+
SKCAPSTONE_AGENT: agent,
|
|
40
|
+
PATH: `${skenvPath()}${sep}${process.env.PATH}`,
|
|
29
41
|
},
|
|
30
42
|
}).trim();
|
|
31
43
|
return { ok: true, output: raw };
|
|
@@ -299,6 +311,62 @@ function createSKCapstoneSoulShowTool() {
|
|
|
299
311
|
};
|
|
300
312
|
}
|
|
301
313
|
|
|
314
|
+
function createSKCapstoneAgentListTool() {
|
|
315
|
+
return {
|
|
316
|
+
name: "skcapstone_agent_list",
|
|
317
|
+
label: "SKCapstone Agent List",
|
|
318
|
+
description:
|
|
319
|
+
"List all skcapstone agent profiles available on this node. Each profile has its own identity, memories, soul, and trust state. Use this to discover which agents can be loaded.",
|
|
320
|
+
parameters: { type: "object", properties: {} },
|
|
321
|
+
async execute() {
|
|
322
|
+
const result = runCli(SKCAPSTONE_BIN, "agents list --json");
|
|
323
|
+
return textResult(result.output);
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function createSKCapstoneAgentStatusTool() {
|
|
329
|
+
return {
|
|
330
|
+
name: "skcapstone_agent_status",
|
|
331
|
+
label: "SKCapstone Agent Status",
|
|
332
|
+
description:
|
|
333
|
+
"Show the status of a specific skcapstone agent profile — identity, memories, trust, sync state. Use this to load a different agent's context into the current OpenClaw session.",
|
|
334
|
+
parameters: {
|
|
335
|
+
type: "object",
|
|
336
|
+
required: ["agent"],
|
|
337
|
+
properties: {
|
|
338
|
+
agent: { type: "string", description: "Agent name (e.g. 'lumina', 'opus', 'jarvis')." },
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
async execute(_id: string, params: Record<string, unknown>) {
|
|
342
|
+
const agent = String(params.agent ?? "");
|
|
343
|
+
const result = runCli(SKCAPSTONE_BIN, `status --agent ${escapeShellArg(agent)}`, agent);
|
|
344
|
+
return textResult(result.output);
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function createSKCapstoneAgentCreateTool() {
|
|
350
|
+
return {
|
|
351
|
+
name: "skcapstone_agent_create",
|
|
352
|
+
label: "SKCapstone Create Agent",
|
|
353
|
+
description:
|
|
354
|
+
"Create a new skcapstone agent profile with its own identity, memory store, and sync folder. The profile will immediately begin syncing via Syncthing to all connected nodes.",
|
|
355
|
+
parameters: {
|
|
356
|
+
type: "object",
|
|
357
|
+
required: ["name"],
|
|
358
|
+
properties: {
|
|
359
|
+
name: { type: "string", description: "Agent name (lowercase, e.g. 'casey', 'nova')." },
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
async execute(_id: string, params: Record<string, unknown>) {
|
|
363
|
+
const name = String(params.name ?? "").toLowerCase();
|
|
364
|
+
const result = runCli(SKCAPSTONE_BIN, `init --name ${escapeShellArg(name)} --agent ${escapeShellArg(name)}`);
|
|
365
|
+
return textResult(result.output);
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
302
370
|
// ── Plugin registration ─────────────────────────────────────────────────
|
|
303
371
|
|
|
304
372
|
const skcapstonePlugin = {
|
|
@@ -324,6 +392,9 @@ const skcapstonePlugin = {
|
|
|
324
392
|
createSKCapstoneSoulSwapTool(),
|
|
325
393
|
createSKCapstoneSoulStatusTool(),
|
|
326
394
|
createSKCapstoneSoulShowTool(),
|
|
395
|
+
createSKCapstoneAgentListTool(),
|
|
396
|
+
createSKCapstoneAgentStatusTool(),
|
|
397
|
+
createSKCapstoneAgentCreateTool(),
|
|
327
398
|
];
|
|
328
399
|
|
|
329
400
|
for (const tool of tools) {
|
|
@@ -344,7 +415,7 @@ const skcapstonePlugin = {
|
|
|
344
415
|
},
|
|
345
416
|
});
|
|
346
417
|
|
|
347
|
-
api.logger.info?.(
|
|
418
|
+
api.logger.info?.(`SKCapstone plugin registered (17 tools + /skcapstone command) [agent=${SKCAPSTONE_AGENT}]`);
|
|
348
419
|
},
|
|
349
420
|
};
|
|
350
421
|
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "skcapstone"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.4"
|
|
8
8
|
description = "Sovereign Agent Framework — conscious AI through identity, trust, memory, and security"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "GPL-3.0-or-later"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# archive-sessions.sh
|
|
3
|
+
# Archive OpenClaw session files that are older than 24h or larger than 200KB.
|
|
4
|
+
# Keeps the 5 most recently modified .jsonl files regardless of size/age.
|
|
5
|
+
# Safe to run multiple times (idempotent).
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
SESSION_DIR="$HOME/.openclaw/agents/lumina/sessions"
|
|
10
|
+
ARCHIVE_DIR="$SESSION_DIR/archive"
|
|
11
|
+
MAX_SIZE_KB=200
|
|
12
|
+
MAX_AGE_HOURS=24
|
|
13
|
+
KEEP_RECENT=5
|
|
14
|
+
|
|
15
|
+
log() { printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$1"; }
|
|
16
|
+
|
|
17
|
+
# Ensure directories exist
|
|
18
|
+
if [ ! -d "$SESSION_DIR" ]; then
|
|
19
|
+
log "Session directory does not exist: $SESSION_DIR — nothing to do."
|
|
20
|
+
exit 0
|
|
21
|
+
fi
|
|
22
|
+
mkdir -p "$ARCHIVE_DIR"
|
|
23
|
+
|
|
24
|
+
# Collect all .jsonl files (not in archive subdir), sorted newest-first
|
|
25
|
+
mapfile -t all_files < <(find "$SESSION_DIR" -maxdepth 1 -name '*.jsonl' -type f -printf '%T@\t%p\n' | sort -rn | cut -f2-)
|
|
26
|
+
|
|
27
|
+
total=${#all_files[@]}
|
|
28
|
+
if [ "$total" -eq 0 ]; then
|
|
29
|
+
log "No .jsonl files found — nothing to do."
|
|
30
|
+
exit 0
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
log "Found $total .jsonl file(s) in $SESSION_DIR"
|
|
34
|
+
|
|
35
|
+
# The first KEEP_RECENT entries (newest) are protected
|
|
36
|
+
archived=0
|
|
37
|
+
for i in "${!all_files[@]}"; do
|
|
38
|
+
file="${all_files[$i]}"
|
|
39
|
+
basename_f="$(basename "$file")"
|
|
40
|
+
|
|
41
|
+
# Skip if already archived (shouldn't happen with maxdepth 1, but be safe)
|
|
42
|
+
if [ "$(dirname "$file")" = "$ARCHIVE_DIR" ]; then
|
|
43
|
+
continue
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Protect the N most recent files
|
|
47
|
+
if [ "$i" -lt "$KEEP_RECENT" ]; then
|
|
48
|
+
log "KEEP (recent #$((i+1))): $basename_f"
|
|
49
|
+
continue
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Check age (older than MAX_AGE_HOURS)
|
|
53
|
+
file_age_sec=$(( $(date +%s) - $(stat -c '%Y' "$file") ))
|
|
54
|
+
old_enough=$(( file_age_sec > MAX_AGE_HOURS * 3600 ))
|
|
55
|
+
|
|
56
|
+
# Check size (larger than MAX_SIZE_KB)
|
|
57
|
+
file_size_kb=$(( $(stat -c '%s' "$file") / 1024 ))
|
|
58
|
+
big_enough=$(( file_size_kb >= MAX_SIZE_KB ))
|
|
59
|
+
|
|
60
|
+
if [ "$old_enough" -eq 1 ] || [ "$big_enough" -eq 1 ]; then
|
|
61
|
+
reason=""
|
|
62
|
+
[ "$old_enough" -eq 1 ] && reason="age=$(( file_age_sec / 3600 ))h"
|
|
63
|
+
[ "$big_enough" -eq 1 ] && { [ -n "$reason" ] && reason="$reason, "; reason="${reason}size=${file_size_kb}KB"; }
|
|
64
|
+
log "ARCHIVE ($reason): $basename_f"
|
|
65
|
+
mv -- "$file" "$ARCHIVE_DIR/$basename_f"
|
|
66
|
+
archived=$((archived + 1))
|
|
67
|
+
else
|
|
68
|
+
log "SKIP (below thresholds): $basename_f"
|
|
69
|
+
fi
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
log "Done. Archived $archived file(s)."
|
package/scripts/install.ps1
CHANGED
|
@@ -162,6 +162,7 @@ Install-Pkg -Name 'skchat-sovereign' -Extras 'all' -Paths @((Join
|
|
|
162
162
|
Install-Pkg -Name 'skseal' -Extras '' -Paths @((Join-Path $ParentDir 'skseal'))
|
|
163
163
|
Install-Pkg -Name 'skskills' -Extras '' -Paths @((Join-Path $ParentDir 'skskills'))
|
|
164
164
|
Install-Pkg -Name 'sksecurity' -Extras '' -Paths @((Join-Path $ParentDir 'sksecurity'))
|
|
165
|
+
Install-Pkg -Name 'skseed' -Extras '' -Paths @((Join-Path $PillarDir 'skseed'), (Join-Path $ParentDir 'skseed'))
|
|
165
166
|
|
|
166
167
|
# ---------------------------------------------------------------------------
|
|
167
168
|
# Step 4: Dev tools (optional)
|
|
@@ -248,6 +249,6 @@ if ($failures -eq 0) {
|
|
|
248
249
|
Write-Host "=== Installation complete with $failures warning(s) ===" -ForegroundColor Yellow
|
|
249
250
|
}
|
|
250
251
|
Write-Host ''
|
|
251
|
-
Write-Host "Commands available: skcomm, skcapstone, capauth, skchat, skseal, skmemory, skskills, sksecurity"
|
|
252
|
+
Write-Host "Commands available: skcomm, skcapstone, capauth, skchat, skseal, skmemory, skskills, sksecurity, skseed"
|
|
252
253
|
Write-Host "Venv location: $SKENV"
|
|
253
254
|
Write-Host "To activate: & $SKENV\Scripts\Activate.ps1"
|
package/scripts/install.sh
CHANGED
|
@@ -118,6 +118,7 @@ install_pkg "skchat-sovereign" "all" "$PARENT/skchat"
|
|
|
118
118
|
install_pkg "skseal" "" "$PARENT/skseal"
|
|
119
119
|
install_pkg "skskills" "" "$PARENT/skskills"
|
|
120
120
|
install_pkg "sksecurity" "" "$PARENT/sksecurity"
|
|
121
|
+
install_pkg "skseed" "" "$PILLAR/skseed $PARENT/skseed"
|
|
121
122
|
|
|
122
123
|
# ---------------------------------------------------------------------------
|
|
123
124
|
# Step 4: Dev tools (optional)
|
|
@@ -180,6 +181,6 @@ else
|
|
|
180
181
|
echo "=== Installation complete with $failures warning(s) ==="
|
|
181
182
|
fi
|
|
182
183
|
echo ""
|
|
183
|
-
echo "Commands available: skcomm, skcapstone, capauth, skchat, skseal, skmemory, skskills, sksecurity"
|
|
184
|
+
echo "Commands available: skcomm, skcapstone, capauth, skchat, skseal, skmemory, skskills, sksecurity, skseed"
|
|
184
185
|
echo "Venv location: $SKENV"
|
|
185
186
|
echo "To activate: source $SKENV/bin/activate"
|