kairos-chain 3.71.0 → 3.73.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8cf3acf9bb95eb62a4fc78d85359540a9089973819fce152278a962007e6faa
4
- data.tar.gz: bcffe011916e72faecc52aeecc68743a7ef25a96a108b509d9cd80531d04b542
3
+ metadata.gz: 4344b2bf968bbb0b650c672522c8abdee9ae34daea4f06899e60cfaf815fa489
4
+ data.tar.gz: e2a99d727e1ca7d404ecdd0945c29e9964220b1ec8aaca8be44f46c55b9a5e77
5
5
  SHA512:
6
- metadata.gz: 759b4cdfe1cc4d6031708d669820994f090d6bf946191d7b3823b9b1f8a3969f9e11193222e8103e065ae20eea290e218638913262ff83225c6250f5f12640b9
7
- data.tar.gz: 8823dd97245c068d475951c908bcdd77807c43b7b0ce6705680d9413ad52bee608bd246c2a97214df6e0253869f87187cce9aaa92f647289a7a1068156c9a01b
6
+ metadata.gz: 9d47b320473eb188dcc9f57655f11cd152ce0cee6e160c714396ebcd508156a5696c0c0db8eeb7ace61956cfc5e61467507a051ce6d200552d95ebe3a7f9ebf1
7
+ data.tar.gz: e38d3d417efb9be7c9e0274d9aca36ba7c1fd062f7ef0ecfc204536f86c99a9bbbbf025a52ee31525caab67b94a3dba88c41fcd3ab9d49313d6a609b10a2e0f8
data/CHANGELOG.md CHANGED
@@ -4,6 +4,168 @@ All notable changes to the `kairos-chain` gem will be documented in this file.
4
4
 
5
5
  This project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [3.73.0] - 2026-08-17
8
+
9
+ ### Fixed
10
+
11
+ - **Round 2 of the same review returned 0 APPROVE of 3 valid seats and thirteen
12
+ more blocking findings, three of them saying round 1's fixes did not hold. The
13
+ response was to subtract.** Two of the six guards round 1 added are removed
14
+ rather than repaired. The `-o` output path is deleted: guarding it by comparing
15
+ resolved paths failed three ways — a case-only difference on a case-insensitive
16
+ filesystem, a hardlink, and any read input the check did not enumerate, which
17
+ included every L2 context and `config/pm.yml` — and each failure destroyed the
18
+ memo while the run printed that nothing had been written to it. The page now
19
+ always goes to `<data dir>/log/pm_l2_report.html`, beside the data directory so a
20
+ relocated instance still finds it, and under a name the operator's own `.gitignore`
21
+ already knows how to handle. The carried `exclude` is
22
+ also removed: carrying it was itself a round-1 fix, and since an exclude term is
23
+ a substring of document names while an inferred term is usually the item's own
24
+ record name, it suppressed the item's own primary record. It still applies to
25
+ the authored terms it was written beside, and the row says when it was not
26
+ applied.
27
+ - **The anti-flood cap bounds the row, not only each term.** Twelve terms each
28
+ under the twenty-document cap unioned to 124 of 1179 documents for one item, and
29
+ a note of the ordinary shape reached 23. A row over the cap is refused rather
30
+ than truncated, because truncation is silent and moves `last_activity` and the
31
+ headline figures with it; the row reports how many its terms reached.
32
+ - **Paths are derived from the script's own location** instead of by appending a
33
+ literal `.kairos`, which had reported a populated instance as empty at exit 0 on
34
+ every session of a relocated data directory. **A row with no comparison names
35
+ which of five things is missing**, separating an unparseable L2 date from an
36
+ unparseable memo marker, because they blame different files and collapsing them
37
+ stated a false fact for the second time. **Nested store shapes are checked**, not
38
+ only their absence: a `projects` or `items` value that was truthy and not an
39
+ object reached `.values()` and raised.
40
+ - **The test file is rewritten, not extended.** An audit applied 65 one-line
41
+ mutations to the round-1 suite and 36 survived — the whole of `main`'s wiring,
42
+ all cross-item aggregation, and the impossible-date guard the suite was named
43
+ for, whose fixture built a second document matching the same term so the valid
44
+ date sorted last and the impossible one never reached the parse point. 53 cases
45
+ now, and of the 30 mutations that map to a reported finding 29 are killed; the
46
+ survivor is equivalent. Four habits are stated in the file: exercise guards
47
+ through `main` in a subprocess, check that a fixture cannot satisfy its own
48
+ assertion, build several rows when testing aggregation, and assert messages and
49
+ exit codes by content. Nothing runs the suite automatically — `rake test`
50
+ collects Ruby files only.
51
+ - **Accepted rather than fixed, and recorded where they happen.** A context
52
+ declaring a parseable but absurd date such as `9999-12-31` flattens the other lag
53
+ bars, which is what bars relative to the widest lag mean. And what the report
54
+ says still depends on which `python3` resolves, since `date.fromisoformat`
55
+ accepts basic format from 3.11. Separately, two stale `.pyc` files sit inside one
56
+ installed SkillSet from earlier runs, so its `content_hash` differs from a clean
57
+ tree's; nothing here removes them.
58
+ - Live data after the change: 28 of 28 items comparable, 19 with L2 more recent,
59
+ median 29 days, widest 81 — identical to before, so nothing the subtraction
60
+ removed was carrying coverage.
61
+
62
+ ## [3.72.0] - 2026-08-17
63
+
64
+ **Built and never published.** Its contents ship in 3.73.0, which carries the second round of fixes to the same feature; the entry is kept because the commits it describes are in the history.
65
+
66
+ ### Fixed
67
+
68
+ - **Six defects in the session-start report below, all found by a pre-release
69
+ multi-LLM review and all demonstrated by running code rather than reasoning
70
+ about it.** The review returned 0 APPROVE of 3 counted seats. Two of the five
71
+ invariants the change declared were false as stated, which is why they are
72
+ listed here rather than deferred.
73
+ - *The read-only promise was prose.* `open(out, "w")` accepted any path, so
74
+ `-o <memo>` truncated `store.json` while the run printed that nothing had been
75
+ written to it. The output path is now refused if it resolves to the memo or
76
+ the mapping, via `realpath`, so a symlink cannot walk around it.
77
+ - *A read-only report changed the SkillSet's chain-recorded hash.*
78
+ `exec_module` writes bytecode, and `scripts/__pycache__/l2_scan.cpython-310.pyc`
79
+ landed inside the SkillSet directory — inside `Skillset#all_file_hashes`, hence
80
+ inside `content_hash`, hence inside what `skillset_manager` records as
81
+ `skillset_event` and verifies with `raise SecurityError`. The recorded hash was
82
+ a function of the local CPython build and of whether the report had run.
83
+ `sys.dont_write_bytecode` is now set around the import.
84
+ - *The anti-flood guard was capped on one tier only.* A document's name is
85
+ `name:` or `title:` or its basename, and 321 of 1177 contexts take it from a
86
+ free-text `title:`. One context titled `Review` made `review` a search term
87
+ reaching 351 records; titled `Context`, all 1178. Both tiers are now capped at
88
+ twenty documents, which costs nothing measurable: of 1125 distinct names none
89
+ reaches more than 20, and the two items that use inference return the same 2
90
+ and 17 records.
91
+ - *A non-string `touched_at` or `due` crashed the report.* `pm_item` writes both
92
+ through with no check beyond a JSON type and this SkillSet's own Ruby suite
93
+ writes the integer `20260701` to each, so slicing them raised `TypeError` — the
94
+ defect `lib/project_manager/parsed_time.rb` exists to prevent, re-acquired at a
95
+ fifth call site because the reader is in another language. Permanent once
96
+ triggered, since the value stays in the store.
97
+ - *One shape-valid impossible date took the whole run down.* `l2_scan` validates
98
+ that a declared date looks like a date, not that it exists, so `2026-02-30`
99
+ reached `date.fromisoformat` outside the `try` — the guard covered one end of
100
+ the interval only. Both ends now go through it.
101
+ - *An unreadable memo marker was reported as unreadable records.* An item with
102
+ seventeen perfectly datable records was described as "records found, none
103
+ datable", and it silently left the denominator: 28/28 matched with median 29
104
+ became 27/28 with median 28.5. The three causes — no terms, undatable records,
105
+ unreadable marker — are now counted and worded apart.
106
+ - **Smaller fixes from the same review.** The authored `exclude` is carried into
107
+ the inference fallback rather than dropped, so a distinction the operator wrote
108
+ down is not undone by the fallback. A mapping whose `include` is a string rather
109
+ than a list no longer expands to single-character terms (one of which matched
110
+ 1177 of 1177 documents, displayed as the operator's own authored mapping).
111
+ `store['projects']`, `mapping['items']` and dependency entries missing `kind` or
112
+ `ref` no longer raise. `--open` falls back to `xdg-open` and survives neither
113
+ binary existing, since the gem ships to Linux. The hook reads `KAIROS_DATA_DIR`
114
+ before `$CLAUDE_PROJECT_DIR/.kairos`, because the data directory is relocatable
115
+ and a relocated instance got a hook pointing at nothing. The hook no longer
116
+ discards stderr or forces a zero exit: doing both made every failure
117
+ indistinguishable from a session where nothing had drifted. Operator-facing text
118
+ no longer renders a Python list repr, and `--quiet` documents the two lines it
119
+ prints instead of three.
120
+ - **`test/test_pm_l2_report.py`, 30 cases, 27 of them red against the version that
121
+ shipped before them.** Of those 27, nine exercise the old behaviour directly and
122
+ eighteen fail because the guard function did not exist — that distinction is
123
+ recorded rather than counted as thirty demonstrations. The remaining three cover
124
+ HTML escaping and a degenerate render, which were already correct and are held
125
+ as regression guards. The suite drives the real `l2_scan.match` rather than a
126
+ copy of it, so the two views cannot disagree about what a term matched.
127
+
128
+ ### Added
129
+
130
+ - **The `project_manager` SkillSet (v0.6.0) reports the memo-versus-L2 drift once
131
+ per session, and no longer needs a human to author search terms first.** The
132
+ memo lags the context store and the lag is invisible from whichever side is
133
+ being read: on the development instance, 19 of 28 items have L2 activity more
134
+ recent than their last memo touch, median 29 days, widest 81. Derivation could
135
+ already measure that, but only when someone remembered to run it and only for
136
+ items a human had authored terms for. Two read-only additions.
137
+ `scripts/pm_l2_report.py` renders the comparison as one HTML page, and
138
+ `plugin/hooks.json` declares it as a `SessionStart` hook so the harness runs it
139
+ without anyone deciding to. `SessionStart` and not `Stop`: this is not a gate,
140
+ it decides nothing, and only Stop-family payloads carry the once-per-turn brake
141
+ `kairos_hook_projector`'s gates need. Delivery is by projection — `skillset
142
+ install` changes no host settings, and the MCP handshake projects on every host
143
+ start, so no core change was needed to reach the host. Whether the newly
144
+ written hook fires on that same start or the following one depends on when the
145
+ host reads its settings relative to the handshake; that ordering is not
146
+ measured, and `kairos-plugin-project` run by hand settles it. `skillset upgrade
147
+ --apply` is not a substitute: it projects only when it actually upgrades
148
+ something, and `project_manager` is not in the core set it upgrades. Measured
149
+ at 0.18s over 1172 contexts; the script writes exactly one file, its own
150
+ output, and the memo's hash is unchanged across a run.
151
+ - **Search terms fall back to inference from the item's own title and notes**
152
+ when the authored mapping has no entry for an item, or its entry matched
153
+ nothing — so no item goes unreported and L2 is never asked to be relabelled.
154
+ Inference cannot replace the mapping and does not try: 43 of 53 hand-authored
155
+ terms appear nowhere in any item's title or notes, having been written from
156
+ knowledge of the work. What it can do is refuse to flood. Only a token that is
157
+ itself the name of an existing L2 document, or a compound identifier reaching
158
+ at most twenty documents, is accepted; a bare English word is refused however
159
+ rare it looks. Accepting bare words returned 51 and 82 records for the two
160
+ items that have almost none, because a defect is described with words like
161
+ store, write, config and yaml, and those match hundreds of unrelated names as
162
+ substrings. Refusing them, the same two return 2 and 17, and all 28 items
163
+ become comparable. The cost is misses — inference alone found 87 records across
164
+ the 24 mapped items where the mapping found 296 — and the trade is deliberate:
165
+ a miss shows up as a smaller count, a spurious record does not show up at all.
166
+ Unchanged by this release: nothing writes to the memo (derivation v0.12 §1),
167
+ and neither the digest's shape nor the secretary's grant moved.
168
+
7
169
  ## [3.71.0] - 2026-08-17
8
170
 
9
171
  ### Added
@@ -1,4 +1,4 @@
1
1
  module KairosMcp
2
- VERSION = "3.71.0"
2
+ VERSION = "3.73.0"
3
3
  CHANGELOG_URL = "https://github.com/masaomi/KairosChain_2026/blob/main/CHANGELOG.md"
4
4
  end
@@ -62,6 +62,94 @@ Prefer the sub-agent for "what needs attention?", at session start, and for sche
62
62
  - **Layer discipline.** These tools never write L0 or L1.
63
63
  - **World-event dependencies are operator-cleared.** The system never auto-resolves them.
64
64
 
65
+ ## The session-start L2 comparison
66
+
67
+ `scripts/pm_l2_report.py` compares the memo against the L2 context store and writes one HTML page,
68
+ to `<data dir>/log/pm_l2_report.html`. `plugin/hooks.json` declares it as a `SessionStart` hook.
69
+
70
+ **Read-only by having no aim, not by checking one.** There is no output-path argument, so nothing
71
+ can point a write at the memo, the mapping, an L2 context, or `config/pm.yml`. An earlier version
72
+ took `-o` and guarded it by comparing resolved paths; that guard failed three ways — a case-only
73
+ difference on a case-insensitive filesystem, a hardlink, and any read input it did not know about —
74
+ and each failure destroyed the memo while the run printed that nothing had been written to it.
75
+ Deleting the argument closed all three. `sys.dont_write_bytecode` is set around the derivation
76
+ import for the same reason a second guard was not added: a `.pyc` inside the SkillSet sits inside
77
+ `Skillset#all_file_hashes` and therefore inside `content_hash`, the value recorded on chain.
78
+
79
+ **Paths come from this file's own location**, three levels up from `scripts/`, not from the name
80
+ `.kairos`. `l2_scan` derives its own by appending that literal, which reported a populated instance
81
+ as empty on every session whenever the data dir had been relocated, so its four path constants are
82
+ re-pointed after import.
83
+
84
+ **Nothing is trusted to have a type.** `pm_item` writes `due` and `touched_at` through with no check
85
+ beyond a JSON type, and this SkillSet's own Ruby suite writes the integer `20260701` to both. Dates
86
+ are parsed in exactly one function, which both ends of every interval go through: `l2_scan`
87
+ validates that a declared date *looks* like a date, never that it exists, so one context declaring
88
+ `2026-02-30` used to take the whole unattended run down.
89
+
90
+ Delivery is by **projection**, not by install, because install alone changes no host settings:
91
+
92
+ ```
93
+ kairos-chain skillset install project_manager files land; the host's settings are untouched
94
+ next start of the host the MCP handshake projects; the hook is written
95
+ ```
96
+
97
+ Whether the hook then fires on that same start or the following one depends on when the host reads
98
+ its settings relative to the handshake; observed firing on the following one. `kairos-plugin-project`
99
+ run by hand settles it, and `skillset upgrade --apply` is not a substitute — it projects only when
100
+ it actually upgrades something, and this SkillSet is not in the core set it upgrades.
101
+
102
+ ### Where search terms come from
103
+
104
+ The authored mapping first. When it has no entry for an item, or its entry matched nothing, terms
105
+ are inferred from that item's own title and notes, so no item goes unreported and L2 is never asked
106
+ to be relabelled. Inference cannot replace the mapping and does not try: 43 of 53 hand-authored
107
+ terms appear nowhere in any item's title or notes, having been written from knowledge of the work.
108
+
109
+ What it can do is refuse to flood, and it took three measurements to get that right, each from a
110
+ reviewer running the code:
111
+
112
+ | what was accepted | what happened | rule now |
113
+ |---|---|---|
114
+ | bare English words | 51 and 82 records for two items that have nearly none, because a defect is described with words like store, write, config and yaml | only a document name or a compound identifier containing an underscore |
115
+ | an uncapped document-name tier | a context titled `Review` made `review` a term reaching 351 records; titled `Context`, all 1178 | both tiers capped at twenty documents per term |
116
+ | a cap per term but not per row | twelve terms each under the cap unioned to 124 of 1179 documents; an ordinary note reached 23 | the row's whole union is capped too, and inference is **refused** rather than truncated |
117
+
118
+ Refused and not truncated, because truncation is silent and moves `last_activity` and the headline
119
+ figures with it. A refused row says its terms were too broad and how many they reached, and the page
120
+ shows the terms — a row claiming no term could be built while not showing what it tried is a claim
121
+ the operator cannot check where it is wrong.
122
+
123
+ **An authored `exclude` stops at the authored terms.** Carrying it into inference was itself a fix
124
+ in an earlier round, and it traded one wrong answer for another: an exclude term is a substring of
125
+ document names, and an inferred term is usually the item's own record name, so carrying it
126
+ suppressed the item's own primary record. The row says so rather than dropping it silently.
127
+
128
+ The cost of all this is misses — across the 24 mapped items, inference alone found 87 records where
129
+ the mapping found 296 — and the trade is deliberate: a miss shows up as a smaller count, a spurious
130
+ record does not show up at all.
131
+
132
+ ### Five reasons, not one
133
+
134
+ A row with no comparison names which side is missing: no usable terms, terms too broad, records
135
+ carrying no date, an L2 date that cannot be parsed, or a memo marker that cannot be parsed. The last
136
+ two are separate sentences because they blame different files. Collapsing them produced a false
137
+ statement twice — first an item with seventeen datable records reported as having none, then a memo
138
+ blamed for a date that L2 had written wrong — and each time the item also left the denominator, so
139
+ the headline figures shrank without saying so.
140
+
141
+ ### Tests
142
+
143
+ `test/test_pm_l2_report.py`. The bar is mutation, not redness against an older commit: breaking a
144
+ guard by one line must make the suite red. An audit of an earlier version applied 65 one-line
145
+ mutations and 36 survived, so guards are now exercised through `main()` in a subprocess, fixtures
146
+ are checked not to satisfy their own assertion, aggregation is tested with several items, and
147
+ messages and exit codes are asserted by content. Of the 30 mutations that map to a reported finding,
148
+ 29 are killed; the survivor is equivalent (deleting the absent-derivation branch leaves the generic
149
+ handler producing the same message, exit code and absence of a traceback).
150
+
151
+ Nothing runs this suite automatically — `rake test` collects Ruby files only.
152
+
65
153
  ## Relation to instruction modes
66
154
 
67
155
  The tools carry no disposition and depend on no particular instruction mode. This SkillSet does
@@ -0,0 +1,46 @@
1
+ {
2
+ "_comment": [
3
+ "Hooks this SkillSet contributes to the host harness. The plugin projector",
4
+ "merges this into the host's settings under a _projected_by tag, so",
5
+ "re-projection replaces only what it put there and leaves hand-written",
6
+ "hooks alone. Installing the SkillSet and re-projecting is the whole",
7
+ "delivery -- nobody edits settings.json by hand.",
8
+ "",
9
+ "SessionStart, not Stop. A Stop-family gate can brake itself once per turn",
10
+ "via stop_hook_active, which is why kairos_hook_projector restricts its",
11
+ "gates to Stop and SubagentStop; this is not a gate. It reports, it decides",
12
+ "nothing, and it runs once when a session opens.",
13
+ "",
14
+ "KAIROS_DATA_DIR before $CLAUDE_PROJECT_DIR/.kairos. The data directory is",
15
+ "relocatable -- KairosMcp.resolve_data_dir reads that variable, and",
16
+ "PluginProjector takes data_dir separately from project_root with a guard",
17
+ "that exists because the two are expected to differ. Hardcoding the second",
18
+ "form meant that on a relocated instance the hook pointed at nothing and,",
19
+ "with stderr discarded, said nothing about it.",
20
+ "",
21
+ "No 2>/dev/null and no || true. Suppressing both turned every failure --",
22
+ "absent script, unreadable store, a stored timestamp that is not a string --",
23
+ "into exit 0 with empty output, which is indistinguishable from a session",
24
+ "where nothing had drifted. The script now handles its own absences and",
25
+ "reports each in one line on stdout, so what is left uncaught is a genuine",
26
+ "defect and should be visible. Measured at 0.18s over 1172 contexts.",
27
+ "",
28
+ "The command does not begin with kairos-, so projection prints one",
29
+ "non-standard-command warning. That is the projector asking a human to look,",
30
+ "and this is what it looks like: a read-only report that refuses an output",
31
+ "path resolving to the memo, and writes only its own HTML."
32
+ ],
33
+ "hooks": {
34
+ "SessionStart": [
35
+ {
36
+ "hooks": [
37
+ {
38
+ "type": "command",
39
+ "command": "python3 \"${KAIROS_DATA_DIR:-$CLAUDE_PROJECT_DIR/.kairos}/skillsets/project_manager/scripts/pm_l2_report.py\" --quiet",
40
+ "timeout": 20
41
+ }
42
+ ]
43
+ }
44
+ ]
45
+ }
46
+ }