@jjanczur/tyran 0.1.3 → 0.1.4
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.
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
{
|
|
12
12
|
"name": "tyran",
|
|
13
13
|
"description": "A task conductor for Claude Code: multi-agent orchestration with an enforced evidence contract, repo-specific learning, and update-safe local evolution.",
|
|
14
|
-
"version": "0.1.
|
|
14
|
+
"version": "0.1.4",
|
|
15
15
|
"source": "./",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "Jacek Janczura",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tyran",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A task conductor for Claude Code: multi-agent orchestration with an enforced evidence contract, repo-specific learning, and update-safe local evolution.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jacek Janczura",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.4 — 2026-08-01
|
|
4
|
+
|
|
5
|
+
### The gate stopped refusing Claude Code's own memory
|
|
6
|
+
|
|
7
|
+
Adopting Tyran in a repo made the policy gate refuse the harness's OWN writes:
|
|
8
|
+
`Write` to `~/.claude/projects/<slug>/memory/*.md` came back "outside this
|
|
9
|
+
repository, class KERNEL". The memory store and the per-session scratchpad are
|
|
10
|
+
genuinely outside every repository, so `repoRelative` returned null and the
|
|
11
|
+
write matrix answered KERNEL — the same branch that correctly refuses writing
|
|
12
|
+
into somebody else's repo. The cost was that the assistant could no longer
|
|
13
|
+
persist what it learned while working in a Tyran repo, and a boundary that
|
|
14
|
+
blocks the tool's own bookkeeping is one its user turns off.
|
|
15
|
+
|
|
16
|
+
The gate now exempts exactly two locations, and only for the `main` thread:
|
|
17
|
+
`<config>/projects/<slug>/memory/` and `<tmp>/claude-<id>/`. Everything else
|
|
18
|
+
outside the repo is still KERNEL; the rest of the config dir — including
|
|
19
|
+
`settings.json`, which registers these very hooks — stays untouchable; and a
|
|
20
|
+
subagent is never exempted, because it has no business writing outside its
|
|
21
|
+
worktree. Bash never hit this: an out-of-repo token yields no finding, so
|
|
22
|
+
`echo > scratch` was already allowed — the refusal lived only on the
|
|
23
|
+
file-writing tools, which is the asymmetry a user actually meets.
|
|
24
|
+
|
|
25
|
+
### npm publishes on a pushed tag
|
|
26
|
+
|
|
27
|
+
`npm-publish.yml` now also triggers on a pushed `v*` tag, not only on a
|
|
28
|
+
published GitHub release. npm served 0.1.0 while the marketplace was three
|
|
29
|
+
releases ahead, because the manual release step was skipped for 0.1.1, 0.1.2
|
|
30
|
+
and 0.1.3; a release step a human has to remember is one that drifts. The
|
|
31
|
+
version-must-match-the-tag guard runs for both triggers, and npm refuses a
|
|
32
|
+
duplicate version, so the two are idempotent.
|
|
33
|
+
|
|
3
34
|
## 0.1.3 — 2026-07-29
|
|
4
35
|
|
|
5
36
|
From two independent field reports on complete initiatives — one M, one L —
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
*/
|
|
66
66
|
import { readFileSync, realpathSync, statSync } from 'node:fs';
|
|
67
67
|
import { readFile, stat } from 'node:fs/promises';
|
|
68
|
-
import {
|
|
68
|
+
import { homedir, tmpdir } from 'node:os';
|
|
69
|
+
import { basename, dirname, join, resolve as resolvePath, sep } from 'node:path';
|
|
69
70
|
import { fileURLToPath } from 'node:url';
|
|
70
71
|
|
|
71
72
|
import { PASS, field, main, runGate } from './hook-io.mjs';
|
|
@@ -680,6 +681,80 @@ function canonicalDeepest(raw) {
|
|
|
680
681
|
return resolvePath(raw);
|
|
681
682
|
}
|
|
682
683
|
|
|
684
|
+
/**
|
|
685
|
+
* The path segments below `base`, canonicalized on BOTH sides, or null when
|
|
686
|
+
* `target` is not under `base`. `canonicalDeepest` on the base too, so `/tmp`
|
|
687
|
+
* and `/private/tmp` — one directory in two spellings on macOS — do not read as
|
|
688
|
+
* two, the same symlink hazard `repoRelative` documents.
|
|
689
|
+
*/
|
|
690
|
+
function segmentsUnder(canonTarget, base) {
|
|
691
|
+
let root;
|
|
692
|
+
try {
|
|
693
|
+
root = canonicalDeepest(base);
|
|
694
|
+
} catch {
|
|
695
|
+
return null;
|
|
696
|
+
}
|
|
697
|
+
if (canonTarget === root) return [];
|
|
698
|
+
const prefix = root.endsWith(sep) ? root : root + sep;
|
|
699
|
+
if (!canonTarget.startsWith(prefix)) return null;
|
|
700
|
+
return canonTarget.slice(prefix.length).split(sep).filter(Boolean);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Claude Code's own two working directories, which belong to no repository:
|
|
705
|
+
* the persistent memory store under the config dir, and the per-session
|
|
706
|
+
* scratchpad under the system temp dir. `repoRelative` returns null for both —
|
|
707
|
+
* they are genuinely outside every repo — so the write matrix answered them
|
|
708
|
+
* with KERNEL, and adopting Tyran in a repo then refused the harness's OWN
|
|
709
|
+
* memory writes: `Write` to `~/.claude/projects/<slug>/memory/*.md` failed with
|
|
710
|
+
* "outside this repository", so the assistant could no longer persist what it
|
|
711
|
+
* learned while working in a Tyran repo. A boundary that blocks the tool's own
|
|
712
|
+
* bookkeeping is one its user turns off.
|
|
713
|
+
*
|
|
714
|
+
* The exemption is narrow on two axes, and both carry weight:
|
|
715
|
+
* - PATH — only the memory store <config>/projects/<slug>/memory and the
|
|
716
|
+
* scratchpad <tmp>/claude-<id>. The rest of the config dir is untouched,
|
|
717
|
+
* so `.claude/settings.json`, which registers these very hooks, stays
|
|
718
|
+
* KERNEL and out of reach. An allowlist of two shapes, never "anything
|
|
719
|
+
* under home".
|
|
720
|
+
* - ACTOR — `main` only, enforced at the call site. A subagent has no
|
|
721
|
+
* business writing outside its worktree; `actorOf` returns `subagent` for
|
|
722
|
+
* it and it still falls through to KERNEL. So the blast radius is an
|
|
723
|
+
* interactive thread writing advisory notes and temp files, not a
|
|
724
|
+
* fanned-out loop reaching across the filesystem.
|
|
725
|
+
*
|
|
726
|
+
* Bash never needed this: an out-of-repo token yields no finding in
|
|
727
|
+
* `shellPathFindings`, so `echo > scratch` was already allowed. The refusal
|
|
728
|
+
* lived only on the file-writing tools, which is the asymmetry a user meets.
|
|
729
|
+
*/
|
|
730
|
+
export function harnessWritable(rawPath, env = process.env) {
|
|
731
|
+
let canon;
|
|
732
|
+
try {
|
|
733
|
+
canon = canonicalDeepest(rawPath);
|
|
734
|
+
} catch {
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
const configDir =
|
|
738
|
+
typeof env.CLAUDE_CONFIG_DIR === 'string' && env.CLAUDE_CONFIG_DIR.trim() !== ''
|
|
739
|
+
? env.CLAUDE_CONFIG_DIR
|
|
740
|
+
: join(homedir(), '.claude');
|
|
741
|
+
const underConfig = segmentsUnder(canon, configDir);
|
|
742
|
+
// The memory store's exact shape: <config>/projects/<slug>/memory/**.
|
|
743
|
+
if (underConfig !== null && underConfig[0] === 'projects' && underConfig[2] === 'memory') {
|
|
744
|
+
return true;
|
|
745
|
+
}
|
|
746
|
+
// The scratchpad: <tmp>/claude-*/**, under whichever temp root the platform
|
|
747
|
+
// used. `/tmp` is included explicitly because `os.tmpdir()` is `/var/...` on
|
|
748
|
+
// macOS while the scratchpad lives under `/private/tmp`.
|
|
749
|
+
for (const tempRoot of new Set([tmpdir(), '/tmp'])) {
|
|
750
|
+
const underTemp = segmentsUnder(canon, tempRoot);
|
|
751
|
+
if (underTemp !== null && underTemp.length >= 1 && /^claude-/.test(underTemp[0])) {
|
|
752
|
+
return true;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return false;
|
|
756
|
+
}
|
|
757
|
+
|
|
683
758
|
/**
|
|
684
759
|
* The repo-relative path, resolved through symlinks on BOTH sides.
|
|
685
760
|
*
|
|
@@ -996,6 +1071,13 @@ export async function decide({ input, runner = runChild, startedAt = Date.now(),
|
|
|
996
1071
|
// and the two would agree in every test that happened to run in the repo
|
|
997
1072
|
// root. Normalization is idempotent, so the resolver's own call is a no-op.
|
|
998
1073
|
const normalized = repoRelative(target, root);
|
|
1074
|
+
// Claude Code's own memory store and per-session scratchpad are outside
|
|
1075
|
+
// every repository, so `normalized` is null and the matrix below answers
|
|
1076
|
+
// KERNEL — which made adopting Tyran refuse the harness's own memory
|
|
1077
|
+
// writes. `harnessWritable` exempts exactly those two locations, and only
|
|
1078
|
+
// for the main thread; a subagent still falls through to KERNEL. See its
|
|
1079
|
+
// definition for the full argument.
|
|
1080
|
+
if (normalized === null && actor === 'main' && harnessWritable(target, env)) continue;
|
|
999
1081
|
// The one branch this cannot delegate: a path outside the repository makes
|
|
1000
1082
|
// `normalizePath` return null, which `classifyPath` answers with KERNEL.
|
|
1001
1083
|
// Restated in one line rather than reached by passing a null through, and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jjanczur/tyran",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Command-line scripts for the Tyran task conductor (doctor, journal, schema, and repo tooling) for CI and terminals outside Claude Code. Installing this package does NOT install the Claude Code plugin — add that separately with `/plugin marketplace add jjanczur/tyran` inside Claude Code.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|