@brandry/claude-jsonl-compressor 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -56
- package/LICENSE +674 -674
- package/NOTICE +8 -8
- package/README.md +666 -611
- package/SKILL.md +230 -345
- package/agents/openai.yaml +7 -7
- package/bin/claude-jsonl-compressor.cjs +4 -4
- package/bin/claude-jsonl-repair-read-pages.cjs +4 -4
- package/bin/run-python.cjs +77 -77
- package/package.json +60 -60
- package/references/claude-jsonl-compression-format.md +635 -578
- package/scripts/claude_session_tools.py +304 -245
- package/scripts/compress_claude_jsonl.py +8608 -8275
- package/scripts/repair_claude_jsonl.py +627 -627
- package/templates/summary_template_en.md +78 -78
package/agents/openai.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Claude JSONL Compressor"
|
|
3
|
-
short_description: "Compress one Claude JSONL with a source-anchored model summary."
|
|
4
|
-
default_prompt: "Use $claude-jsonl-compressor on
|
|
5
|
-
|
|
6
|
-
policy:
|
|
7
|
-
allow_implicit_invocation: true
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Claude JSONL Compressor"
|
|
3
|
+
short_description: "Compress one Claude JSONL with a source-anchored model summary."
|
|
4
|
+
default_prompt: "Use $claude-jsonl-compressor on one Claude Code JSONL. Preflight the last-prompt chain and evidence capacity, exclude rewound branches, preserve its final name and requested recent context, use the model-assisted two-pass workflow, and validate the result. Follow the skill's backup, strict old-summary, cost and optional review rules; use full tool evidence when the user's research requires it. Keep repair separate and do not broaden the target."
|
|
5
|
+
|
|
6
|
+
policy:
|
|
7
|
+
allow_implicit_invocation: true
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
require("./run-python.cjs").runPython("compress_claude_jsonl.py");
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
require("./run-python.cjs").runPython("compress_claude_jsonl.py");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
require("./run-python.cjs").runPython("repair_claude_jsonl.py");
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
require("./run-python.cjs").runPython("repair_claude_jsonl.py");
|
package/bin/run-python.cjs
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
const path = require("node:path");
|
|
5
|
-
const { spawn } = require("node:child_process");
|
|
6
|
-
|
|
7
|
-
function candidates() {
|
|
8
|
-
const configured = process.env.PYTHON;
|
|
9
|
-
const list = [];
|
|
10
|
-
if (configured) {
|
|
11
|
-
list.push({ command: configured, prefix: [] });
|
|
12
|
-
}
|
|
13
|
-
if (process.platform === "win32") {
|
|
14
|
-
list.push({ command: "py", prefix: ["-3"] });
|
|
15
|
-
list.push({ command: "python", prefix: [] });
|
|
16
|
-
list.push({ command: "python3", prefix: [] });
|
|
17
|
-
} else {
|
|
18
|
-
list.push({ command: "python3", prefix: [] });
|
|
19
|
-
list.push({ command: "python", prefix: [] });
|
|
20
|
-
}
|
|
21
|
-
return list;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function runPython(scriptName) {
|
|
25
|
-
const scriptPath = path.resolve(__dirname, "..", "scripts", scriptName);
|
|
26
|
-
const options = candidates();
|
|
27
|
-
|
|
28
|
-
function launch(index) {
|
|
29
|
-
if (index >= options.length) {
|
|
30
|
-
process.stderr.write("ERROR: Python 3.10 or newer was not found. Set PYTHON to an executable path.\n");
|
|
31
|
-
process.exitCode = 127;
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const selected = options[index];
|
|
35
|
-
const child = spawn(
|
|
36
|
-
selected.command,
|
|
37
|
-
[...selected.prefix, "-B", scriptPath, ...process.argv.slice(2)],
|
|
38
|
-
{ shell: false, stdio: "inherit", windowsHide: true }
|
|
39
|
-
);
|
|
40
|
-
let started = false;
|
|
41
|
-
child.once("spawn", () => {
|
|
42
|
-
started = true;
|
|
43
|
-
});
|
|
44
|
-
child.once("error", (error) => {
|
|
45
|
-
if (!started && error && error.code === "ENOENT") {
|
|
46
|
-
launch(index + 1);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
process.stderr.write(`ERROR: failed to launch Python: ${error.message}\n`);
|
|
50
|
-
process.exitCode = 1;
|
|
51
|
-
});
|
|
52
|
-
child.once("exit", (code, signal) => {
|
|
53
|
-
if (signal) {
|
|
54
|
-
try {
|
|
55
|
-
process.kill(process.pid, signal);
|
|
56
|
-
} catch (_error) {
|
|
57
|
-
process.exitCode = 1;
|
|
58
|
-
}
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
process.exitCode = Number.isInteger(code) ? code : 1;
|
|
62
|
-
});
|
|
63
|
-
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
64
|
-
process.once(signal, () => {
|
|
65
|
-
try {
|
|
66
|
-
child.kill(signal);
|
|
67
|
-
} catch (_error) {
|
|
68
|
-
process.exitCode = 1;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
launch(0);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
module.exports = { runPython };
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const { spawn } = require("node:child_process");
|
|
6
|
+
|
|
7
|
+
function candidates() {
|
|
8
|
+
const configured = process.env.PYTHON;
|
|
9
|
+
const list = [];
|
|
10
|
+
if (configured) {
|
|
11
|
+
list.push({ command: configured, prefix: [] });
|
|
12
|
+
}
|
|
13
|
+
if (process.platform === "win32") {
|
|
14
|
+
list.push({ command: "py", prefix: ["-3"] });
|
|
15
|
+
list.push({ command: "python", prefix: [] });
|
|
16
|
+
list.push({ command: "python3", prefix: [] });
|
|
17
|
+
} else {
|
|
18
|
+
list.push({ command: "python3", prefix: [] });
|
|
19
|
+
list.push({ command: "python", prefix: [] });
|
|
20
|
+
}
|
|
21
|
+
return list;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function runPython(scriptName) {
|
|
25
|
+
const scriptPath = path.resolve(__dirname, "..", "scripts", scriptName);
|
|
26
|
+
const options = candidates();
|
|
27
|
+
|
|
28
|
+
function launch(index) {
|
|
29
|
+
if (index >= options.length) {
|
|
30
|
+
process.stderr.write("ERROR: Python 3.10 or newer was not found. Set PYTHON to an executable path.\n");
|
|
31
|
+
process.exitCode = 127;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const selected = options[index];
|
|
35
|
+
const child = spawn(
|
|
36
|
+
selected.command,
|
|
37
|
+
[...selected.prefix, "-B", scriptPath, ...process.argv.slice(2)],
|
|
38
|
+
{ shell: false, stdio: "inherit", windowsHide: true }
|
|
39
|
+
);
|
|
40
|
+
let started = false;
|
|
41
|
+
child.once("spawn", () => {
|
|
42
|
+
started = true;
|
|
43
|
+
});
|
|
44
|
+
child.once("error", (error) => {
|
|
45
|
+
if (!started && error && error.code === "ENOENT") {
|
|
46
|
+
launch(index + 1);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
process.stderr.write(`ERROR: failed to launch Python: ${error.message}\n`);
|
|
50
|
+
process.exitCode = 1;
|
|
51
|
+
});
|
|
52
|
+
child.once("exit", (code, signal) => {
|
|
53
|
+
if (signal) {
|
|
54
|
+
try {
|
|
55
|
+
process.kill(process.pid, signal);
|
|
56
|
+
} catch (_error) {
|
|
57
|
+
process.exitCode = 1;
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
process.exitCode = Number.isInteger(code) ? code : 1;
|
|
62
|
+
});
|
|
63
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
64
|
+
process.once(signal, () => {
|
|
65
|
+
try {
|
|
66
|
+
child.kill(signal);
|
|
67
|
+
} catch (_error) {
|
|
68
|
+
process.exitCode = 1;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
launch(0);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = { runPython };
|
package/package.json
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@brandry/claude-jsonl-compressor",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Strict, model-assisted compression and byte-preserving compatibility repair for one Claude Code JSONL session.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"claude-code",
|
|
7
|
-
"claude-cli",
|
|
8
|
-
"jsonl",
|
|
9
|
-
"context-compression",
|
|
10
|
-
"context-window",
|
|
11
|
-
"conversation-memory",
|
|
12
|
-
"session-transcript",
|
|
13
|
-
"summarization",
|
|
14
|
-
"rewind",
|
|
15
|
-
"model-assisted",
|
|
16
|
-
"llm",
|
|
17
|
-
"developer-tools"
|
|
18
|
-
],
|
|
19
|
-
"author": {
|
|
20
|
-
"name": "Brandry Labs",
|
|
21
|
-
"url": "https://github.com/brandrylabs"
|
|
22
|
-
},
|
|
23
|
-
"type": "commonjs",
|
|
24
|
-
"license": "GPL-3.0-only",
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/brandrylabs/claude-jsonl-compressor.git"
|
|
28
|
-
},
|
|
29
|
-
"homepage": "https://github.com/brandrylabs/claude-jsonl-compressor#readme",
|
|
30
|
-
"bugs": {
|
|
31
|
-
"url": "https://github.com/brandrylabs/claude-jsonl-compressor/issues"
|
|
32
|
-
},
|
|
33
|
-
"bin": {
|
|
34
|
-
"claude-jsonl-compressor": "bin/claude-jsonl-compressor.cjs",
|
|
35
|
-
"claude-jsonl-repair-read-pages": "bin/claude-jsonl-repair-read-pages.cjs"
|
|
36
|
-
},
|
|
37
|
-
"files": [
|
|
38
|
-
"SKILL.md",
|
|
39
|
-
"CHANGELOG.md",
|
|
40
|
-
"NOTICE",
|
|
41
|
-
"agents/*.yaml",
|
|
42
|
-
"bin/*.cjs",
|
|
43
|
-
"config/*.json",
|
|
44
|
-
"references/*.md",
|
|
45
|
-
"scripts/*.py",
|
|
46
|
-
"templates/*.md",
|
|
47
|
-
"README.md",
|
|
48
|
-
"LICENSE"
|
|
49
|
-
],
|
|
50
|
-
"engines": {
|
|
51
|
-
"node": ">=22"
|
|
52
|
-
},
|
|
53
|
-
"scripts": {
|
|
54
|
-
"test": "python -B -m unittest discover -s tests -v"
|
|
55
|
-
},
|
|
56
|
-
"publishConfig": {
|
|
57
|
-
"access": "public",
|
|
58
|
-
"tag": "latest"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@brandry/claude-jsonl-compressor",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Strict, model-assisted compression and byte-preserving compatibility repair for one Claude Code JSONL session.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"claude-cli",
|
|
8
|
+
"jsonl",
|
|
9
|
+
"context-compression",
|
|
10
|
+
"context-window",
|
|
11
|
+
"conversation-memory",
|
|
12
|
+
"session-transcript",
|
|
13
|
+
"summarization",
|
|
14
|
+
"rewind",
|
|
15
|
+
"model-assisted",
|
|
16
|
+
"llm",
|
|
17
|
+
"developer-tools"
|
|
18
|
+
],
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "Brandry Labs",
|
|
21
|
+
"url": "https://github.com/brandrylabs"
|
|
22
|
+
},
|
|
23
|
+
"type": "commonjs",
|
|
24
|
+
"license": "GPL-3.0-only",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/brandrylabs/claude-jsonl-compressor.git"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/brandrylabs/claude-jsonl-compressor#readme",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/brandrylabs/claude-jsonl-compressor/issues"
|
|
32
|
+
},
|
|
33
|
+
"bin": {
|
|
34
|
+
"claude-jsonl-compressor": "bin/claude-jsonl-compressor.cjs",
|
|
35
|
+
"claude-jsonl-repair-read-pages": "bin/claude-jsonl-repair-read-pages.cjs"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"SKILL.md",
|
|
39
|
+
"CHANGELOG.md",
|
|
40
|
+
"NOTICE",
|
|
41
|
+
"agents/*.yaml",
|
|
42
|
+
"bin/*.cjs",
|
|
43
|
+
"config/*.json",
|
|
44
|
+
"references/*.md",
|
|
45
|
+
"scripts/*.py",
|
|
46
|
+
"templates/*.md",
|
|
47
|
+
"README.md",
|
|
48
|
+
"LICENSE"
|
|
49
|
+
],
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=22"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"test": "python -B -m unittest discover -s tests -v"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public",
|
|
58
|
+
"tag": "latest"
|
|
59
|
+
}
|
|
60
|
+
}
|