kairos-chain 3.76.0 → 3.78.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: 83162bcb26c033c10413fe1f25ffed382031dfebc115aa7041438d807177ef8c
4
- data.tar.gz: eacc1ed007ad60d8429954c1d0e0bca228048a5a0438f177df892e72aae3e599
3
+ metadata.gz: 3bdf5a0932b91258ccacf0520ca20eb252b7080c7ef3682f87edb8fdb07144c6
4
+ data.tar.gz: '09f911f59d0aba91f246f5ec6721cc4ee11f8534bd96ed73fc31edd3df1a78ff'
5
5
  SHA512:
6
- metadata.gz: e6e311e80bc090726582d7032aa87a0ac1a97ffea387b300306d609f19b0a38c4dbe2cd6a84dd36e924e66c3e9f579b56f91c1c25602cc2afdae21e8f8e2005c
7
- data.tar.gz: 0ffddbff73ac05f8804b343e597495517b3872a0ceed500ef1370aab8f034a866b20585a5a03c46db179fbacfd18aff3862a70fc40c093f66389a69f2afdc4c2
6
+ metadata.gz: 884fe864157b0c5ea27cc9249de0378f4c8e53d0b724ef6c92e9adc85dd1a092e8c7291c1e0e778a20d3edf4058da92801968733f38017a73df60eb7b552ade3
7
+ data.tar.gz: c9061d247bee27b8525dae1d14f4acd1036e27d2c024b74228c43bc23211329285d418689aa6314c70f2e5f6060b9df4ad68e118870b680f6c411ab5d2de5cc7
data/CHANGELOG.md CHANGED
@@ -4,6 +4,83 @@ 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.78.0] - 2026-08-26
8
+
9
+ ### Fixed
10
+
11
+ - **`readable_gate` — a failed note write no longer leaves an earlier turn's
12
+ note in place.** The carry-over note (shipped in 3.77.0) records which
13
+ record the gate blocked, so the recheck measures only what came after it. A
14
+ leftover note from an interrupted turn — 28 of 240 blocks draw no recheck —
15
+ survived the next block's failed note write, checked out as valid, and the
16
+ recheck judged the message that block had just made. A record with no uuid
17
+ was input enough. Every write failure now spends the leftover: deleted, or —
18
+ when deletion is refused — truncated in place, since deletion needs
19
+ directory-write while truncation needs only file-write, and an emptied note
20
+ fails the parse on every later read whatever the directory permits by then.
21
+ Only a leftover refusing both deletion and truncation survives, and the
22
+ design declares that state rather than claiming it closed. Found by
23
+ conformance review rounds 2-4: six reading contexts per round answering a
24
+ fixed claim list (21 → 4 → 2 → 1 claims), each finding reproduced end-to-end
25
+ before its fix, and round 4 closing with zero claims disputed. 133 tests /
26
+ 815 assertions; 54 mutations killed 54/54; first-read stdout byte-identical
27
+ to the 3.74.0 baseline across up to 2,520 inputs measured by four
28
+ independent contexts.
29
+
30
+ ## [3.77.0] - 2026-08-26
31
+
32
+ ### Added
33
+
34
+ - **`operator_report` — the agent SkillSet's first tool for handing a
35
+ deliverable to a human.** Three runs produced documents no one could receive;
36
+ the loop concluded "there is no way to deliver this" and it was right. The
37
+ tool writes the report body to a file under `.kairos/log/agent_reports/` and
38
+ returns only the path, because the executor truncates tool output at 500
39
+ characters. It is registered `low` in the risk table — an unlisted tool would
40
+ be marked by norm (d) and the report itself would wait for human
41
+ confirmation. Two norms ship with it: (e) an irreversible step is marked and
42
+ deferred, not a reason to halt the plan; (f) a delivery tool exists — do not
43
+ conclude there is no way to hand the result over.
44
+
45
+ - **`test_agent_human_mark_gate.rb`** — 39 tests, 87 assertions, covering the
46
+ deferred-mark path, halt-kind classification, and the cumulative cycle
47
+ ledger.
48
+
49
+ ### Changed
50
+
51
+ - **Seven fixes surfaced by running the loop, not by reviewing it.** The goal
52
+ text never reached the DECIDE prompt — the loop was judging without its goal;
53
+ it is now included, truncated at 6,000 characters with the cut declared in
54
+ the text. Halt kinds were hardcoded to one kind, so tool errors were recorded
55
+ as "waiting for human"; the kind now reads from each step's own status, and
56
+ the seven-site refactor a prior design round estimated for this turned out
57
+ unnecessary. A plan halted at its first human-marked step; `human_mark_mode:
58
+ 'defer'` sets marked steps and their dependents aside, runs the rest, and
59
+ returns the deferred list at the cycle's end (the default remains `halt`).
60
+ The completed-cycle count was per call; the ledger now accumulates across the
61
+ run. Norm (d) pulled read-only tools into confirmation waits; it now names
62
+ writing, recording, sending, and deleting tools only, and its counter is
63
+ renamed `unlisted_writing_tool_unmarked` with the old name's counts folded
64
+ in. Report titles doubled when the body already opened with a heading; they
65
+ no longer do.
66
+
67
+ ### Removed
68
+
69
+ - **The 300-second wall clock and `max_cycles`.** The clock was shorter than
70
+ one measured cycle (823 seconds for a 13-step cycle); both caps are gone.
71
+ What still stops a run: the call budget (`max_total_llm_calls`, default 60 —
72
+ about 15 cycles at the measured 4 calls per cycle), two consecutive errors,
73
+ loop detection, self-declared completion at confidence ≥ 0.9, and the
74
+ `checkpoint_every` return, where continuing is decided by whether the
75
+ operator calls the next `agent_step`. The uncapped run that validated this
76
+ went three cycles: the first drafted a priority list, the second found and
77
+ corrected six errors in it, the third declined to write a third version,
78
+ declared the second canonical, and returned four open items — zero norm
79
+ violations, confidence never reaching the self-completion threshold. Mutation
80
+ testing covers the session's first half (11 mutants, 11 killed); the latter
81
+ eight fixes ship unmutated by operator decision — this release exists to find
82
+ their defects in use.
83
+
7
84
  ## [3.76.0] - 2026-08-22
8
85
 
9
86
  ### Changed
@@ -1,4 +1,4 @@
1
1
  module KairosMcp
2
- VERSION = "3.76.0"
2
+ VERSION = "3.78.0"
3
3
  CHANGELOG_URL = "https://github.com/masaomi/KairosChain_2026/blob/main/CHANGELOG.md"
4
4
  end
@@ -30,6 +30,10 @@ tool_blacklist:
30
30
  - "skills_rollback"
31
31
  - "skills_promote"
32
32
  - "instructions_update"
33
+ # The norms the agent is held to live in L1. A run with risk_budget: medium
34
+ # would otherwise reach knowledge_update (medium in TOOL_RISK) and let the
35
+ # constrained side rewrite what constrains it.
36
+ - "knowledge_update"
33
37
  - "token_manage"
34
38
  - "system_upgrade"
35
39
  - "chain_import"
@@ -82,8 +86,15 @@ orient_tools_extra: []
82
86
 
83
87
  # Autonomous mode limits
84
88
  autonomous:
85
- max_total_llm_calls: 60 # across all cycles in one batch
86
- max_duration_seconds: 300 # wall-clock timeout per batch (5 min)
89
+ # The cost bound, and the one that actually stops a runaway. At the ~4 calls
90
+ # per cycle measured on 2026-08-26 this is about 15 cycles.
91
+ max_total_llm_calls: 60
92
+ # Wall-clock bound, off. Blank or 0 means no bound: the loop runs until it is
93
+ # done rather than until the clock says so. It never interrupted a running
94
+ # cycle — it only refused to start the next — so at 300 against a measured
95
+ # 823-second cycle it just made max_cycles above 1 unreachable. Withdrawn
96
+ # 2026-08-26; put a number back only if a run is seen to go on too long.
97
+ max_duration_seconds:
87
98
  min_cycles_before_exit: 2 # confidence exit disabled for first N cycles
88
99
  confidence_exit_threshold: 0.9 # minimum confidence for early exit
89
100
 
@@ -6,13 +6,37 @@ module KairosMcp
6
6
  # Bridges agent structures to Autonomos::Mandate API shapes.
7
7
  # Input: string keys (from JSON.parse). Output: symbol keys (for Mandate API).
8
8
  module MandateAdapter
9
+ # Tools whose presence routes the whole plan to the agent_execute
10
+ # subcontractor instead of in-process autoexec.
11
+ #
12
+ # Defined here rather than in agent_step because the risk gate and the
13
+ # ACT router must agree on the route. If they disagree, a plan can be
14
+ # granted the human-mark exemption below and then run under the
15
+ # subcontractor, which formats steps as prose and never reads the mark
16
+ # — the marked step would be delegated rather than halted on.
17
+ FILE_TOOL_NAMES = %w[Edit Write Read Bash file_edit file_write file_read].freeze
18
+
19
+ def self.routes_to_subcontractor?(task_json)
20
+ steps = task_json && task_json['steps']
21
+ Array(steps).any? { |s| FILE_TOOL_NAMES.include?(s['tool_name']) }
22
+ end
23
+
9
24
  # Convert decision_payload to Mandate-compatible proposal
10
25
  # for Mandate.risk_exceeds_budget? and Mandate.loop_detected?
26
+ #
27
+ # enforce_human_marks declares that this caller halts before a marked
28
+ # step at execution time. It lives inside autoexec_task, beside the
29
+ # steps it qualifies, because risk_exceeds_budget? reads that hash and a
30
+ # declaration written elsewhere than it is read is the whole defect.
11
31
  def self.to_mandate_proposal(decision_payload)
32
+ task_json = decision_payload['task_json']
12
33
  {
13
34
  autoexec_task: {
14
- steps: (decision_payload.dig('task_json', 'steps') || []).map { |s|
15
- { risk: s['risk'] || 'low', tool_name: s['tool_name'] }
35
+ enforce_human_marks: !routes_to_subcontractor?(task_json),
36
+ steps: Array(task_json && task_json['steps']).map { |s|
37
+ { risk: s['risk'] || 'low',
38
+ tool_name: s['tool_name'],
39
+ requires_human_cognition: s['requires_human_cognition'] == true }
16
40
  }
17
41
  },
18
42
  selected_gap: {
@@ -14,7 +14,8 @@
14
14
  "KairosMcp::SkillSets::Agent::Tools::AgentStep",
15
15
  "KairosMcp::SkillSets::Agent::Tools::AgentStatus",
16
16
  "KairosMcp::SkillSets::Agent::Tools::AgentStop",
17
- "KairosMcp::SkillSets::Agent::Tools::AgentWait"
17
+ "KairosMcp::SkillSets::Agent::Tools::AgentWait",
18
+ "KairosMcp::SkillSets::Agent::Tools::OperatorReport"
18
19
  ],
19
20
  "config_files": ["config/agent.yml"],
20
21
  "knowledge_dirs": ["knowledge/agent_guide"],
@@ -69,7 +69,7 @@ module Autonomos
69
69
  end
70
70
  end
71
71
 
72
- require File.expand_path('../../../../.kairos/skillsets/autonomos/lib/autonomos/mandate',
72
+ require File.expand_path('../autonomos/lib/autonomos/mandate',
73
73
  File.dirname(__dir__))
74
74
 
75
75
  Session = KairosMcp::SkillSets::Agent::Session
@@ -67,10 +67,10 @@ module Autonomos
67
67
  end
68
68
  end
69
69
 
70
- require File.expand_path('../../../../.kairos/skillsets/autonomos/lib/autonomos/mandate',
70
+ require File.expand_path('../autonomos/lib/autonomos/mandate',
71
71
  File.dirname(__dir__))
72
72
  # The autonomous loop reaches Ooda for goal loading and COMPLEX_KEYWORDS.
73
- require File.expand_path('../../../../.kairos/skillsets/autonomos/lib/autonomos/ooda',
73
+ require File.expand_path('../autonomos/lib/autonomos/ooda',
74
74
  File.dirname(__dir__))
75
75
 
76
76
  Session = KairosMcp::SkillSets::Agent::Session