samagotchi 0.141.0 → 0.143.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 +4 -4
- data/CHANGELOG.md +111 -7
- data/README.md +2 -1
- data/bin/chi +2 -0
- data/docs/architecture.md +25 -289
- data/docs/bundle-authoring.md +7 -6
- data/docs/bundles.md +1232 -0
- data/docs/cli.md +51 -13
- data/docs/configuration.md +68 -30
- data/docs/context.md +12 -12
- data/docs/guardrails.md +27 -20
- data/docs/hooks.md +28 -9
- data/docs/internals/attached-context.md +225 -0
- data/docs/internals/background-tasks.md +1 -1
- data/docs/internals/bridge.md +380 -0
- data/docs/internals/bundles.md +6 -3
- data/docs/internals/context-telemetry.md +1 -1
- data/docs/internals/engine.md +31 -19
- data/docs/internals/participants.md +13 -12
- data/docs/internals/prompt-caching.md +12 -12
- data/docs/internals/remote-sessions.md +1 -1
- data/docs/internals/{tool-guardrails.md → tool-output-limits.md} +21 -2
- data/docs/internals/web-push.md +1 -1
- data/docs/memory.md +33 -3
- data/docs/plugins.md +127 -1231
- data/docs/sessions.md +51 -27
- data/docs/sub-agent.md +6 -6
- data/docs/system-one.md +122 -0
- data/docs/testing.md +3 -1
- data/lib/samagotchi/bridge.rb +2 -0
- data/lib/samagotchi/bundle_command/api_calls.rb +132 -0
- data/lib/samagotchi/bundle_command/check.rb +50 -34
- data/lib/samagotchi/bundle_command/installed_check.rb +86 -0
- data/lib/samagotchi/bundle_command/scaffold.rb +1 -0
- data/lib/samagotchi/bundle_settings_check.rb +58 -0
- data/lib/samagotchi/bundles/agents-md/manifest.yml +4 -2
- data/lib/samagotchi/bundles/agents-md/plugin.rb +1 -1
- data/lib/samagotchi/bundles/btw/manifest.yml +4 -2
- data/lib/samagotchi/bundles/btw/plugin.rb +1 -1
- data/lib/samagotchi/bundles/check-in/manifest.yml +7 -3
- data/lib/samagotchi/bundles/check-in/plugin.rb +101 -11
- data/lib/samagotchi/bundles/claude-peer/manifest.yml +3 -3
- data/lib/samagotchi/bundles/claude-peer/plugin.rb +1 -1
- data/lib/samagotchi/bundles/claude-peer/scripts/pair +1 -1
- data/lib/samagotchi/bundles/codex-peer/manifest.yml +2 -2
- data/lib/samagotchi/bundles/codex-peer/plugin.rb +1 -1
- data/lib/samagotchi/bundles/coordinator/manifest.yml +2 -2
- data/lib/samagotchi/bundles/coordinator/plugin.rb +1 -1
- data/lib/samagotchi/bundles/core/manifest.yml +2 -2
- data/lib/samagotchi/bundles/cost-cap/manifest.yml +6 -3
- data/lib/samagotchi/bundles/cost-cap/plugin.rb +5 -7
- data/lib/samagotchi/bundles/github-pr/manifest.yml +3 -1
- data/lib/samagotchi/bundles/known-names/manifest.yml +3 -1
- data/lib/samagotchi/bundles/loop-guard/manifest.yml +4 -2
- data/lib/samagotchi/bundles/loop-guard/plugin.rb +1 -1
- data/lib/samagotchi/bundles/mcp/manifest.yml +4 -2
- data/lib/samagotchi/bundles/mcp/plugin.rb +2 -2
- data/lib/samagotchi/bundles/ruby/manifest.yml +2 -2
- data/lib/samagotchi/bundles/ruby/plugin.rb +1 -1
- data/lib/samagotchi/bundles/skills/manifest.yml +4 -2
- data/lib/samagotchi/bundles/skills/plugin.rb +1 -1
- data/lib/samagotchi/bundles/slow-commands/manifest.yml +4 -2
- data/lib/samagotchi/bundles/slow-commands/plugin.rb +1 -1
- data/lib/samagotchi/bundles/source-links/manifest.yml +3 -1
- data/lib/samagotchi/bundles/system/config_modification_protocol.md +3 -3
- data/lib/samagotchi/bundles/system/manifest.yml +4 -4
- data/lib/samagotchi/bundles/system/memory_guide.md +1 -1
- data/lib/samagotchi/bundles/system/self_map.md +3 -3
- data/lib/samagotchi/bundles/work-cap/manifest.yml +6 -3
- data/lib/samagotchi/bundles/work-cap/plugin.rb +11 -13
- data/lib/samagotchi/config.rb +74 -14
- data/lib/samagotchi/context_candidate_choice.rb +20 -3
- data/lib/samagotchi/context_candidates.rb +4 -1
- data/lib/samagotchi/context_candidates_log.rb +36 -1
- data/lib/samagotchi/context_judge.rb +6 -2
- data/lib/samagotchi/context_status.rb +1 -2
- data/lib/samagotchi/engine.rb +96 -70
- data/lib/samagotchi/extension_load.rb +11 -4
- data/lib/samagotchi/guardrail_wiring.rb +36 -31
- data/lib/samagotchi/guardrails/chi_dirs.rb +7 -4
- data/lib/samagotchi/guardrails/path_resolve.rb +1 -1
- data/lib/samagotchi/guardrails/protected_paths.rb +7 -4
- data/lib/samagotchi/guardrails_command.rb +3 -3
- data/lib/samagotchi/hook_routes.rb +37 -2
- data/lib/samagotchi/hooks/bundle_loader.rb +20 -4
- data/lib/samagotchi/hooks/registry.rb +23 -5
- data/lib/samagotchi/host_model.rb +3 -3
- data/lib/samagotchi/host_registry.rb +14 -7
- data/lib/samagotchi/judgments_command.rb +155 -0
- data/lib/samagotchi/kernel_loop.rb +20 -3
- data/lib/samagotchi/llm/chat_loop.rb +79 -10
- data/lib/samagotchi/llm/errors.rb +7 -5
- data/lib/samagotchi/llm/stray_tool_call.rb +68 -0
- data/lib/samagotchi/log_line.rb +1 -1
- data/lib/samagotchi/memory_bundle/builder.rb +4 -2
- data/lib/samagotchi/memory_bundle/entry_size.rb +100 -0
- data/lib/samagotchi/memory_bundle/installed_bundle.rb +9 -2
- data/lib/samagotchi/memory_bundle/installed_copy.rb +92 -0
- data/lib/samagotchi/memory_bundle/installer.rb +2 -0
- data/lib/samagotchi/memory_bundle/manifest.rb +23 -13
- data/lib/samagotchi/memory_bundle/provenance.rb +4 -1
- data/lib/samagotchi/memory_bundle/shipped_update.rb +13 -1
- data/lib/samagotchi/model_catalog.rb +3 -2
- data/lib/samagotchi/models_command.rb +1 -1
- data/lib/samagotchi/plugin/api.rb +41 -7
- data/lib/samagotchi/plugin/context.rb +59 -1
- data/lib/samagotchi/plugin/judgments.rb +72 -0
- data/lib/samagotchi/plugin/loader.rb +6 -3
- data/lib/samagotchi/plugin/peer.rb +17 -22
- data/lib/samagotchi/plugin_session_state.rb +32 -5
- data/lib/samagotchi/prompt_warmup.rb +1 -9
- data/lib/samagotchi/run_options.rb +1 -0
- data/lib/samagotchi/self_report.rb +36 -0
- data/lib/samagotchi/session_access/contract.rb +1 -1
- data/lib/samagotchi/session_access/local.rb +1 -1
- data/lib/samagotchi/session_access/remote.rb +3 -3
- data/lib/samagotchi/session_archive_command.rb +3 -3
- data/lib/samagotchi/session_commands.rb +7 -4
- data/lib/samagotchi/session_config.rb +9 -3
- data/lib/samagotchi/session_continue.rb +1 -1
- data/lib/samagotchi/session_manager.rb +25 -5
- data/lib/samagotchi/session_retention.rb +10 -0
- data/lib/samagotchi/side_judgments.rb +12 -1
- data/lib/samagotchi/system_one/answer.rb +63 -11
- data/lib/samagotchi/system_one/approval_label.rb +56 -0
- data/lib/samagotchi/system_one/approval_question.rb +2 -0
- data/lib/samagotchi/system_one/client.rb +43 -17
- data/lib/samagotchi/system_one/fake_backend.rb +1 -1
- data/lib/samagotchi/system_one/http_backend.rb +12 -4
- data/lib/samagotchi/system_one/judgment_settings.rb +61 -0
- data/lib/samagotchi/system_one/judgments.rb +243 -0
- data/lib/samagotchi/system_one/log.rb +25 -2
- data/lib/samagotchi/system_one/recording.rb +117 -0
- data/lib/samagotchi/system_one/runs.rb +179 -0
- data/lib/samagotchi/system_one/runs_store.rb +230 -0
- data/lib/samagotchi/system_one.rb +9 -0
- data/lib/samagotchi/terminal_ui/attach_link.rb +2 -2
- data/lib/samagotchi/terminal_ui/attached_loop/exit_commands.rb +1 -1
- data/lib/samagotchi/terminal_ui/attached_loop.rb +1 -1
- data/lib/samagotchi/terminal_ui/local_link.rb +1 -1
- data/lib/samagotchi/terminal_ui/remote_link.rb +1 -2
- data/lib/samagotchi/testing/bundle.rb +9 -2
- data/lib/samagotchi/testing/host.rb +2 -1
- data/lib/samagotchi/testing/judgments.rb +176 -0
- data/lib/samagotchi/testing/recorder.rb +5 -0
- data/lib/samagotchi/testing/recording_api.rb +1 -1
- data/lib/samagotchi/tool_output_cut.rb +26 -6
- data/lib/samagotchi/tool_response.rb +1 -1
- data/lib/samagotchi/tool_runner.rb +63 -4
- data/lib/samagotchi/toolkit_suggest.rb +11 -2
- data/lib/samagotchi/tools/memory.rb +28 -0
- data/lib/samagotchi/turn_note.rb +9 -0
- data/lib/samagotchi/update_command.rb +49 -16
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +1 -0
- data/lib/samagotchi/web/auto_update.rb +79 -49
- data/lib/samagotchi/web/auto_update_record.rb +59 -0
- data/lib/samagotchi/web/public/app.js +8 -4
- data/lib/samagotchi/web/public/hash_intent.js +24 -0
- data/lib/samagotchi/web/public/index.html +3 -1
- data/lib/samagotchi/web/public/revise_stack.js +14 -5
- data/lib/samagotchi/web/session_control.rb +3 -3
- data/lib/samagotchi/web/update_check.rb +7 -6
- data/lib/samagotchi/web/update_ops.rb +80 -25
- metadata +23 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "prism"
|
|
4
3
|
require "rbconfig"
|
|
5
4
|
require "stringio"
|
|
6
5
|
require "tmpdir"
|
|
@@ -10,6 +9,7 @@ require_relative "../memory_bundle/memory_files"
|
|
|
10
9
|
require_relative "../plugin/api"
|
|
11
10
|
require_relative "../version"
|
|
12
11
|
require_relative "../cli/flags"
|
|
12
|
+
require_relative "api_calls"
|
|
13
13
|
|
|
14
14
|
module Samagotchi
|
|
15
15
|
class BundleCommand
|
|
@@ -24,6 +24,10 @@ module Samagotchi
|
|
|
24
24
|
# plugin's and hooks' own code runs as written; --fix rewrites stale
|
|
25
25
|
# sha256 lines (MemoryBundle::Shas). #run returns 0 without errors, 1
|
|
26
26
|
# with any.
|
|
27
|
+
#
|
|
28
|
+
# installed: true is `chi update`'s look at a bundle someone else wrote
|
|
29
|
+
# (InstalledCheck, on a MemoryBundle::InstalledCopy): what this chi breaks
|
|
30
|
+
# of it, and none of what only its author can act on in a source tree.
|
|
27
31
|
class Check
|
|
28
32
|
HELP = <<~TEXT
|
|
29
33
|
Usage: chi bundle check [PATH] [--fix] [--set KEY=VALUE]
|
|
@@ -61,27 +65,33 @@ module Samagotchi
|
|
|
61
65
|
# @param dir [String] the bundle's folder
|
|
62
66
|
# @param fix [Boolean] rewrite stale sha lines
|
|
63
67
|
# @param settings [Hash] config.yml `bundles: <name>:` for the load
|
|
64
|
-
|
|
68
|
+
# @param installed [Boolean] +dir+ is a bundle's installed copy
|
|
69
|
+
def initialize(dir, fix: false, settings: {}, installed: false, stdout: $stdout)
|
|
65
70
|
@dir = File.expand_path(dir)
|
|
66
71
|
@fix = fix
|
|
67
72
|
@settings = settings
|
|
73
|
+
@installed = installed
|
|
68
74
|
@stdout = stdout
|
|
69
75
|
@findings = []
|
|
70
76
|
end
|
|
71
77
|
|
|
78
|
+
# @return [Array<Finding>] what #run found
|
|
79
|
+
attr_reader :findings
|
|
80
|
+
|
|
72
81
|
# @return [Integer] exit status
|
|
73
82
|
def run
|
|
74
83
|
manifest = read_manifest
|
|
75
84
|
if manifest
|
|
76
85
|
missing = check_files(manifest)
|
|
77
|
-
|
|
78
|
-
check_shas unless missing
|
|
86
|
+
check_source_tree(manifest, missing) unless @installed
|
|
79
87
|
check_requires_chi(manifest)
|
|
80
|
-
check_trust(manifest)
|
|
88
|
+
check_trust(manifest) unless @installed
|
|
81
89
|
check_clash(manifest)
|
|
90
|
+
check_settings(manifest) unless @installed
|
|
82
91
|
check_install(manifest) unless missing || placeholders? || manifest.session_settings_clash
|
|
92
|
+
check_api(manifest)
|
|
83
93
|
check_boundary(manifest)
|
|
84
|
-
check_tests
|
|
94
|
+
check_tests unless @installed
|
|
85
95
|
end
|
|
86
96
|
errors = @findings.count(&:error?)
|
|
87
97
|
warnings = @findings.count { |f| f.level == :warn }
|
|
@@ -92,6 +102,11 @@ module Samagotchi
|
|
|
92
102
|
|
|
93
103
|
private
|
|
94
104
|
|
|
105
|
+
def check_source_tree(manifest, missing)
|
|
106
|
+
check_unlisted(manifest)
|
|
107
|
+
check_shas unless missing
|
|
108
|
+
end
|
|
109
|
+
|
|
95
110
|
def add(level, code, file, message, line: nil, fix: nil)
|
|
96
111
|
finding = Finding.new(level: level, code: code, file: file, line: line, message: message, fix: fix)
|
|
97
112
|
@findings << finding
|
|
@@ -204,10 +219,10 @@ module Samagotchi
|
|
|
204
219
|
@too_new = true
|
|
205
220
|
add(:error, :"requires-chi", "manifest.yml", "this chi can't load it: #{failure}", line: line,
|
|
206
221
|
fix: "chi update, or lower requires_chi")
|
|
207
|
-
elsif manifest.requires_chi.nil? && code?(manifest)
|
|
222
|
+
elsif manifest.requires_chi.nil? && code?(manifest) && !@installed
|
|
208
223
|
add(:warn, :"requires-chi", "manifest.yml", "no requires_chi for a bundle with code", fix: "add requires_chi: \">= #{VERSION}\"")
|
|
209
224
|
end
|
|
210
|
-
check_floor(manifest, line) if manifest.plugin && manifest.requires_chi && !@too_new
|
|
225
|
+
check_floor(manifest, line) if manifest.plugin && manifest.requires_chi && !@too_new && !@installed
|
|
211
226
|
end
|
|
212
227
|
|
|
213
228
|
# The plugin calls an API newer than the oldest chi requires_chi admits.
|
|
@@ -217,7 +232,7 @@ module Samagotchi
|
|
|
217
232
|
|
|
218
233
|
source = File.read(path(manifest.plugin[:file]))
|
|
219
234
|
calls = source.scan(API_CALL).flat_map { |call| [call, call.split(".").first(2).join(".")] }
|
|
220
|
-
calls = (calls +
|
|
235
|
+
calls = (calls + ApiCalls.new(source).keywords).uniq.select { |call| Plugin::Api::SINCE.key?(call) }
|
|
221
236
|
call = calls.max_by { |c| Gem::Version.new(Plugin::Api::SINCE[c]) } or return
|
|
222
237
|
version = Plugin::Api::SINCE[call]
|
|
223
238
|
return unless Gem::Version.new(version) > floor
|
|
@@ -228,29 +243,6 @@ module Samagotchi
|
|
|
228
243
|
fix: "requires_chi: \">= #{version}\"")
|
|
229
244
|
end
|
|
230
245
|
|
|
231
|
-
# Each API call's keywords in +source+, as "chi.toolkit(groups:)": the
|
|
232
|
-
# call's receiver as written, its name and the keyword (Prism sees
|
|
233
|
-
# them with or without parens, over lines). Nothing when it doesn't parse.
|
|
234
|
-
def keyword_calls(source)
|
|
235
|
-
result = Prism.parse(source)
|
|
236
|
-
return [] unless result.success?
|
|
237
|
-
|
|
238
|
-
found = []
|
|
239
|
-
nodes = [result.value]
|
|
240
|
-
while (node = nodes.pop)
|
|
241
|
-
nodes.concat(node.compact_child_nodes)
|
|
242
|
-
next unless node.is_a?(Prism::CallNode) && node.receiver && node.arguments
|
|
243
|
-
|
|
244
|
-
call = "#{node.receiver.slice}.#{node.name}"
|
|
245
|
-
node.arguments.arguments.grep(Prism::KeywordHashNode).each do |hash|
|
|
246
|
-
hash.elements.each do |pair|
|
|
247
|
-
found << "#{call}(#{pair.key.unescaped}:)" if pair.is_a?(Prism::AssocNode) && pair.key.is_a?(Prism::SymbolNode)
|
|
248
|
-
end
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
found
|
|
252
|
-
end
|
|
253
|
-
|
|
254
246
|
def lower_bound(requirement)
|
|
255
247
|
requirement.to_s.split(",").filter_map do |part|
|
|
256
248
|
version = part.strip[LOWER_BOUND, 1]
|
|
@@ -279,8 +271,9 @@ module Samagotchi
|
|
|
279
271
|
add(:warn, :clash, "manifest.yml", "chi ships a bundle named #{name}; installing this one replaces chi's",
|
|
280
272
|
line: manifest_line("name"), fix: "rename the bundle")
|
|
281
273
|
end
|
|
282
|
-
# A shipped bundle installed from any chi's copy is that bundle
|
|
283
|
-
|
|
274
|
+
# A shipped bundle installed from any chi's copy is that bundle; an
|
|
275
|
+
# installed copy is the installed bundle.
|
|
276
|
+
return if shipped? || @installed
|
|
284
277
|
|
|
285
278
|
record = installed_record(name)
|
|
286
279
|
return unless record
|
|
@@ -342,11 +335,23 @@ module Samagotchi
|
|
|
342
335
|
$stderr = saved
|
|
343
336
|
end
|
|
344
337
|
|
|
338
|
+
# --set KEY=VALUE against the manifest's settings:, as config.yml's are.
|
|
339
|
+
def check_settings(manifest)
|
|
340
|
+
return if manifest.settings.nil? || @settings.empty?
|
|
341
|
+
|
|
342
|
+
require_relative "../bundle_settings_check"
|
|
343
|
+
record = MemoryBundle::InstalledBundle.new(name: manifest.name, settings: manifest.settings, setting_types: manifest.setting_types,
|
|
344
|
+
session_settings: manifest.session_settings)
|
|
345
|
+
BundleSettingsCheck.record_warnings(record, @settings).each { |line| add(:warn, :settings, "manifest.yml", line, line: manifest_line("settings")) }
|
|
346
|
+
end
|
|
347
|
+
|
|
345
348
|
def install_warnings(warnings)
|
|
346
349
|
stale_reported = @findings.any? { |f| f.code == :sha }
|
|
347
350
|
warnings.each do |warning|
|
|
348
351
|
next if stale_reported && warning.start_with?("Checksum mismatch")
|
|
349
352
|
next if @too_new && warning.include?("won't load:")
|
|
353
|
+
# This machine's PATH, said at install; nothing a chi update changed.
|
|
354
|
+
next if @installed && warning.start_with?("needs ")
|
|
350
355
|
|
|
351
356
|
if warning.start_with?("needs ")
|
|
352
357
|
add(:warn, :install, "manifest.yml", warning)
|
|
@@ -383,6 +388,17 @@ module Samagotchi
|
|
|
383
388
|
|
|
384
389
|
# ── what it reaches of chi ────────────────────────────────────────
|
|
385
390
|
|
|
391
|
+
# A warning, as a name past the boundary is: the plugin may be written
|
|
392
|
+
# for a newer chi, and a call on a path that never runs breaks nothing.
|
|
393
|
+
def check_api(manifest)
|
|
394
|
+
file = manifest.plugin && manifest.plugin[:file]
|
|
395
|
+
return unless file && File.file?(path(file))
|
|
396
|
+
|
|
397
|
+
ApiCalls.new(File.read(path(file))).findings.each do |finding|
|
|
398
|
+
add(:warn, :api, file, finding.message, line: finding.line, fix: finding.fix)
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
|
|
386
402
|
def check_boundary(manifest)
|
|
387
403
|
require_relative "../testing/boundary"
|
|
388
404
|
known = shipped? ? Testing::Boundary::EXCEPTIONS.fetch(manifest.name, {}) : {}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require "stringio"
|
|
5
|
+
require "tmpdir"
|
|
6
|
+
require_relative "../config"
|
|
7
|
+
require_relative "../memory_bundle/installed_copy"
|
|
8
|
+
require_relative "../memory_bundle/shipped_update"
|
|
9
|
+
require_relative "../process_group"
|
|
10
|
+
require_relative "check"
|
|
11
|
+
|
|
12
|
+
module Samagotchi
|
|
13
|
+
class BundleCommand
|
|
14
|
+
# `chi update`'s look at a bundle chi didn't ship: Check (installed: true)
|
|
15
|
+
# on its InstalledCopy, under the chi running now. It runs the bundle's
|
|
16
|
+
# code, as every session does, so in a child of its own: a plugin that
|
|
17
|
+
# exits, hangs, prints or patches something is that bundle's finding and
|
|
18
|
+
# reaches neither the update nor the next bundle.
|
|
19
|
+
module InstalledCheck
|
|
20
|
+
# Seconds a bundle's check may take; a load takes well under one.
|
|
21
|
+
TIMEOUT = 30
|
|
22
|
+
# level: "warn" or "error"; text: Check::Finding's line, on one line.
|
|
23
|
+
Found = Data.define(:level, :text)
|
|
24
|
+
|
|
25
|
+
module_function
|
|
26
|
+
|
|
27
|
+
# @param bundle [MemoryBundle::InstalledBundle]
|
|
28
|
+
# @return [Array<Found>] its warnings and errors; never raises for the bundle
|
|
29
|
+
def run(bundle)
|
|
30
|
+
$stdout.flush
|
|
31
|
+
$stderr.flush
|
|
32
|
+
Dir.mktmpdir("chi-installed-check-") { |tmp| in_child(bundle, File.join(tmp, "answer.json")) }
|
|
33
|
+
rescue SystemCallError, IOError, JSON::ParserError => e
|
|
34
|
+
# JSON: a child that died mid-write (a full disk) left half an answer.
|
|
35
|
+
[died("#{e.class}: #{e.message}")]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def in_child(bundle, answer)
|
|
39
|
+
pid = Process.fork do
|
|
40
|
+
Process.setpgid(0, 0)
|
|
41
|
+
[STDIN, STDOUT, STDERR].zip(%w[r w w]) { |io, mode| io.reopen(File::NULL, mode) }
|
|
42
|
+
File.write(answer, JSON.generate(answer_of(bundle)))
|
|
43
|
+
Process.exit!(0)
|
|
44
|
+
rescue Exception => e # rubocop:disable Lint/RescueException -- a plugin's exit too: the bundle's row
|
|
45
|
+
File.write(answer, JSON.generate([{ level: "error", text: check_line("the check died: #{e.class}: #{e.message}") }]))
|
|
46
|
+
Process.exit!(1)
|
|
47
|
+
end
|
|
48
|
+
waiter = Process.detach(pid)
|
|
49
|
+
unless waiter.join(TIMEOUT)
|
|
50
|
+
ProcessGroup.signal(pid, "KILL", leader: true)
|
|
51
|
+
waiter.join
|
|
52
|
+
return [died("no answer in #{TIMEOUT} s", prefix: false)]
|
|
53
|
+
end
|
|
54
|
+
return [died("exit status #{waiter.value.exitstatus.inspect}")] unless File.file?(answer)
|
|
55
|
+
|
|
56
|
+
JSON.parse(File.read(answer)).map { |row| Found.new(level: row["level"], text: row["text"].gsub(/\s*\n\s*/, " ").strip) }
|
|
57
|
+
end
|
|
58
|
+
private_class_method :in_child
|
|
59
|
+
|
|
60
|
+
# What the child sends: an edited file, which the copy's own shas can't
|
|
61
|
+
# tell, and Check's warnings and errors, naming the installed bundle's
|
|
62
|
+
# folder rather than the copy's.
|
|
63
|
+
def answer_of(bundle)
|
|
64
|
+
edited = MemoryBundle::ShippedUpdate.edited_executables(bundle.name, bundle).map do |file|
|
|
65
|
+
Check::Finding.new(level: :warn, code: :edited, file: file, line: nil, fix: "chi bundle upgrade #{bundle.name}, or reinstall it",
|
|
66
|
+
message: "changed since it was installed, so chi doesn't load it")
|
|
67
|
+
end
|
|
68
|
+
edited = edited.map { |finding| { level: finding.level, text: finding.to_s } }
|
|
69
|
+
installed_dir = MemoryBundle::Provenance.new(name: bundle.name).bundle_dir
|
|
70
|
+
edited + MemoryBundle::InstalledCopy.with(bundle) do |dir|
|
|
71
|
+
check = Check.new(dir, settings: ConfigFile.bundle_settings.fetch(bundle.name, {}), installed: true, stdout: StringIO.new)
|
|
72
|
+
check.run
|
|
73
|
+
check.findings.reject { |finding| finding.level == :info }
|
|
74
|
+
.map { |finding| { level: finding.level, text: finding.to_s.gsub(dir, installed_dir) } }
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
private_class_method :answer_of
|
|
78
|
+
|
|
79
|
+
def died(why, prefix: true) = Found.new(level: "error", text: check_line(prefix ? "the check died: #{why}" : why))
|
|
80
|
+
private_class_method :died
|
|
81
|
+
|
|
82
|
+
def check_line(message) = Check::Finding.new(level: :error, code: :check, file: "manifest.json", line: nil, message: message, fix: nil).to_s
|
|
83
|
+
private_class_method :check_line
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "config"
|
|
4
|
+
require_relative "session_config"
|
|
5
|
+
require_relative "memory_bundle/provenance"
|
|
6
|
+
|
|
7
|
+
module Samagotchi
|
|
8
|
+
# config.yml `bundles:` against what's installed, for a typo that would
|
|
9
|
+
# otherwise do nothing in silence: a name no bundle has, and a key or a
|
|
10
|
+
# value's type a manifest's settings: rules out. A config file only warns:
|
|
11
|
+
# the rest of it still runs, and `chi --set` is what refuses
|
|
12
|
+
# (SessionConfig.check!, in the same words). A manifest with no settings:
|
|
13
|
+
# (a record from before them too) has its keys left alone.
|
|
14
|
+
module BundleSettingsCheck
|
|
15
|
+
module_function
|
|
16
|
+
|
|
17
|
+
# @param section [Hash{String => Hash}] ConfigFile.bundle_settings
|
|
18
|
+
# @return [Array<String>] one line per finding
|
|
19
|
+
def warnings(section, dir: MemoryBundle::Provenance.bundles_dir)
|
|
20
|
+
return [] if section.empty?
|
|
21
|
+
|
|
22
|
+
installed = MemoryBundle::Provenance.each_installed(dir: dir).to_h
|
|
23
|
+
section.flat_map do |name, values|
|
|
24
|
+
bundle = installed[name]
|
|
25
|
+
next ["config.yml bundles: #{name}: #{SessionConfig.no_installed_bundle(name)}#{near(name, installed.keys)}"] unless bundle
|
|
26
|
+
next [] if bundle.error?
|
|
27
|
+
|
|
28
|
+
record_warnings(bundle, values)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# One bundle's +values+ against its record (or a manifest as one); none
|
|
33
|
+
# while it declares no settings:.
|
|
34
|
+
# @param bundle [MemoryBundle::InstalledBundle]
|
|
35
|
+
# @return [Array<String>]
|
|
36
|
+
def record_warnings(bundle, values)
|
|
37
|
+
return [] if bundle.settings.nil?
|
|
38
|
+
|
|
39
|
+
values.flat_map { |key, value| value_warnings(bundle, key.to_s, value) }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def value_warnings(bundle, key, value)
|
|
43
|
+
where = "config.yml bundles: #{bundle.name}.#{key}"
|
|
44
|
+
known = bundle.settings | bundle.session_settings
|
|
45
|
+
return ["#{where}: #{SessionConfig.takes_keys(bundle.name, known)}#{near(key, known)}"] unless known.include?(key)
|
|
46
|
+
|
|
47
|
+
takes, what = SessionConfig::TYPES[bundle.setting_types[key]]
|
|
48
|
+
takes && !takes.call(value) ? ["#{where}: #{SessionConfig.wrong_type(bundle.name, key, what, value)}"] : []
|
|
49
|
+
end
|
|
50
|
+
private_class_method :value_warnings
|
|
51
|
+
|
|
52
|
+
def near(name, names)
|
|
53
|
+
close = Config.near_names(name, names).first
|
|
54
|
+
close ? " (did you mean #{close}?)" : ""
|
|
55
|
+
end
|
|
56
|
+
private_class_method :near
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agents-md
|
|
3
|
-
version: 0.1.
|
|
3
|
+
version: 0.1.1
|
|
4
4
|
scope: system
|
|
5
5
|
description: "Steers a nested AGENTS.md into the conversation the first time a tool touches a file under its directory"
|
|
6
6
|
trust_level: reviewed
|
|
7
7
|
plugin:
|
|
8
8
|
file: plugin.rb
|
|
9
|
-
sha256: sha256:
|
|
9
|
+
sha256: sha256:56527b9d12cb9acd8f57ca00881ab159894ae2fb8def22bce66ac3774bb4187b
|
|
10
10
|
# ctx.prompt_files, read when the plugin loads (0.60.0)
|
|
11
11
|
requires_chi: ">= 0.60.0"
|
|
12
|
+
# config.yml bundles: agents-md: (another key warns; an older chi ignores this)
|
|
13
|
+
settings: [tools, max_chars]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# The agents-md bundle (docs/
|
|
3
|
+
# The agents-md bundle (docs/bundles.md, The agents-md bundle): a nested
|
|
4
4
|
# AGENTS.md of the session's checkout is steered into the conversation the
|
|
5
5
|
# first time a tool touches a file under its directory.
|
|
6
6
|
#
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: btw
|
|
3
|
-
version: 0.1.
|
|
3
|
+
version: 0.1.3
|
|
4
4
|
scope: system
|
|
5
5
|
description: "/btw <question>: a side answer about the conversation, as a card in every UI, even mid-turn; Keep as session forks it into a child session"
|
|
6
6
|
trust_level: reviewed
|
|
7
7
|
plugin:
|
|
8
8
|
file: plugin.rb
|
|
9
|
-
sha256: sha256:
|
|
9
|
+
sha256: sha256:6497129b06d1c3061c1d7d9d7a9c3dfdbcf790e8f2049addad0c26d24771015f
|
|
10
10
|
requires_chi: ">= 0.1.30"
|
|
11
|
+
# config.yml bundles: btw: (another key warns; an older chi ignores this)
|
|
12
|
+
settings: [max_tokens, timeout]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# The btw bundle (docs/
|
|
3
|
+
# The btw bundle (docs/bundles.md, The btw bundle): /btw <question> asks the
|
|
4
4
|
# session's model a side question about the conversation. The answer shows
|
|
5
5
|
# as a card in every UI and goes nowhere else: the conversation, the saved
|
|
6
6
|
# session and the model's next turn never see it. The card's "Keep as
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: check-in
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.3.1
|
|
4
4
|
scope: system
|
|
5
5
|
description: "Checks on a long turn: after N tool calls with no answer, a card asks the user (Nudge / Keep going / Stop), or the model is nudged to say what it has found"
|
|
6
6
|
trust_level: reviewed
|
|
7
7
|
plugin:
|
|
8
8
|
file: plugin.rb
|
|
9
|
-
sha256: sha256:
|
|
10
|
-
|
|
9
|
+
sha256: sha256:732f144471d146832d2f01a5e999463be789a35af476fbc5d97349091c07aea2
|
|
10
|
+
# check-in.progress asks System 1 (chi.judgment, new in 0.142.0);
|
|
11
|
+
# ctx.session_dir is new in the next chi
|
|
12
|
+
requires_chi: ">= 0.143.0"
|
|
13
|
+
# config.yml bundles: check-in: (another key warns; an older chi ignores this)
|
|
14
|
+
settings: [after, every, mode, message, ignore_tools]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# The check-in bundle (docs/
|
|
3
|
+
# The check-in bundle (docs/bundles.md, The check-in bundle): a turn that
|
|
4
4
|
# has made many tool calls without answering gets checked on. After `after`
|
|
5
5
|
# tool calls (then every `every` more) it asks the user with a card (Nudge /
|
|
6
6
|
# Keep going / Stop), nudges the model by itself, or only says so.
|
|
@@ -22,17 +22,23 @@
|
|
|
22
22
|
# Mutex.
|
|
23
23
|
#
|
|
24
24
|
# What /checkin changes (on/off, mode, the threshold) is the session's: it
|
|
25
|
-
# is saved in the
|
|
25
|
+
# is saved in the session's folder (ctx.session_dir) and read back
|
|
26
26
|
# when the session comes back (a worker's restart), before its first turn
|
|
27
27
|
# or command. Another session starts from the settings.
|
|
28
28
|
#
|
|
29
|
+
# Each check-in also asks System 1 `check-in.progress` (docs/system-one.md),
|
|
30
|
+
# off until the user sets a mode for it: the turn's prompt, the calls since
|
|
31
|
+
# the last check-in and the count and elapsed time go, on a side thread, to
|
|
32
|
+
# the cheap judgment model. Nothing is done with the answer: it is saved,
|
|
33
|
+
# and what the user then did with the card is saved as a label on that run.
|
|
34
|
+
# The card, the nudge and the notify are the same either way.
|
|
35
|
+
#
|
|
29
36
|
# Settings (config.yml, bundles: check-in:):
|
|
30
37
|
# after: 50 tool calls in one turn before the first check-in
|
|
31
38
|
# every: 50 then again every this many more
|
|
32
39
|
# mode: ask ask | nudge | notify
|
|
33
40
|
# message: "..." what a nudge says; {calls} is the count
|
|
34
41
|
# ignore_tools: [task_wait, task_get, delegate_result]
|
|
35
|
-
require "fileutils"
|
|
36
42
|
require "json"
|
|
37
43
|
require "securerandom"
|
|
38
44
|
|
|
@@ -43,6 +49,15 @@ class Plugin
|
|
|
43
49
|
DEFAULT_IGNORE = %w[task_wait task_get delegate_result].freeze
|
|
44
50
|
LAST_TOOLS = 5
|
|
45
51
|
USAGE = "usage: /checkin [on|off|<calls>|mode ask|nudge|notify|nudge|later|stop]"
|
|
52
|
+
# The audit judgment (docs/plugins.md, Judgments): one noul question per
|
|
53
|
+
# check-in, answered on a side thread and never acted on.
|
|
54
|
+
PROGRESS = "progress"
|
|
55
|
+
PROGRESS_QUESTION = "Is this turn still making progress toward what the user asked?"
|
|
56
|
+
# The calls since the last check-in, each cut as it is captured and kept
|
|
57
|
+
# together under about 4 KB (the oldest go first).
|
|
58
|
+
CALL_CHARS = 120
|
|
59
|
+
RESULT_CHARS = 200
|
|
60
|
+
CALLS_TOTAL = 4096
|
|
46
61
|
|
|
47
62
|
def initialize(settings = {})
|
|
48
63
|
@after = positive(settings["after"]) || 50
|
|
@@ -59,7 +74,11 @@ class Plugin
|
|
|
59
74
|
end
|
|
60
75
|
|
|
61
76
|
def register(chi)
|
|
62
|
-
chi
|
|
77
|
+
# An older chi has no judgments; the check-in itself is the same there.
|
|
78
|
+
@declared = chi.respond_to?(:judgment)
|
|
79
|
+
chi.judgment PROGRESS, questions: { PROGRESS => { type: "noul", instructions: PROGRESS_QUESTION } } if @declared
|
|
80
|
+
|
|
81
|
+
chi.on(:before_turn) { |event, ctx| before_turn(event, ctx) }
|
|
63
82
|
chi.on(:after_tool_call) { |event, ctx| after_tool_call(event, ctx) }
|
|
64
83
|
chi.on(:after_turn) { |event, ctx| after_turn(event, ctx) }
|
|
65
84
|
chi.command "/checkin", "check on a long turn: status, on|off, <calls>, mode ask|nudge|notify, nudge, later, stop",
|
|
@@ -82,13 +101,21 @@ class Plugin
|
|
|
82
101
|
@nudge = nil # the card's Nudge this turn: { text:, count: }
|
|
83
102
|
@checked_in = nil # the count at this turn's latest check-in
|
|
84
103
|
@nudged_for = nil # the check-in (its count, :none before one) nudged
|
|
104
|
+
@prompt = nil # the owner's prompt, for the judgment
|
|
105
|
+
@calls_since = [] # the calls since the last check-in, for the judgment
|
|
106
|
+
@calls_bytes = 0
|
|
107
|
+
@run = nil # the latest check-in's run, for its labels
|
|
85
108
|
end
|
|
86
109
|
|
|
87
|
-
def before_turn(ctx)
|
|
110
|
+
def before_turn(event, ctx)
|
|
88
111
|
close_card(ctx, "The turn ended after #{calls} tool calls.")
|
|
89
112
|
@mutex.synchronize do
|
|
90
113
|
load_session(ctx)
|
|
91
114
|
reset
|
|
115
|
+
# A continue, a wake or a reminder has no prompt of its own, and a
|
|
116
|
+
# participant's turn says nothing about the owner's: the judgment gets
|
|
117
|
+
# none then.
|
|
118
|
+
@prompt = ctx.turn_author ? nil : event[:prompt]
|
|
92
119
|
end
|
|
93
120
|
end
|
|
94
121
|
|
|
@@ -100,13 +127,17 @@ class Plugin
|
|
|
100
127
|
load_session(ctx)
|
|
101
128
|
@count += 1
|
|
102
129
|
@tools = (@tools + [tool]).last(LAST_TOOLS)
|
|
130
|
+
note_call(event)
|
|
103
131
|
next nil unless @enabled && @count >= @next_at
|
|
104
132
|
|
|
105
133
|
@next_at = @count + @every
|
|
106
134
|
@checked_in = @count
|
|
107
135
|
[@count, @mode]
|
|
108
136
|
end
|
|
109
|
-
|
|
137
|
+
return unless due
|
|
138
|
+
|
|
139
|
+
check_in(ctx, *due)
|
|
140
|
+
ask_progress(ctx)
|
|
110
141
|
end
|
|
111
142
|
|
|
112
143
|
def check_in(ctx, count, mode)
|
|
@@ -128,7 +159,7 @@ class Plugin
|
|
|
128
159
|
end
|
|
129
160
|
|
|
130
161
|
def after_turn(event, ctx)
|
|
131
|
-
|
|
162
|
+
label(ctx, "turn_stopped", by: "turn", strength: nil) if close_card(ctx, "The turn ended after #{calls} tool calls.")
|
|
132
163
|
|
|
133
164
|
nudge_not_sent(event, ctx)
|
|
134
165
|
end
|
|
@@ -191,6 +222,61 @@ class Plugin
|
|
|
191
222
|
true
|
|
192
223
|
end
|
|
193
224
|
|
|
225
|
+
# --- the progress judgment (audit) ---------------------------------------
|
|
226
|
+
|
|
227
|
+
# Every counted call since the last check-in, in the words System 1 sees:
|
|
228
|
+
# the tool, what it was asked for, what it said. Cut here, so the state
|
|
229
|
+
# stays near 4 KB whatever a tool returned (docs/system-one.md: this is
|
|
230
|
+
# tool output reaching System 1, which approvals and context never send).
|
|
231
|
+
def note_call(event)
|
|
232
|
+
entry = "#{event[:tool]} #{cut(call_args(event[:call]), CALL_CHARS)} -> #{cut(event[:result] || event[:output], RESULT_CHARS)}"
|
|
233
|
+
@calls_since << entry
|
|
234
|
+
@calls_bytes += entry.bytesize
|
|
235
|
+
@calls_bytes -= @calls_since.shift.bytesize while @calls_bytes > CALLS_TOTAL && @calls_since.size > 1
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def call_args(call)
|
|
239
|
+
args = call.is_a?(Hash) ? (call[:arguments] || call["arguments"] || call) : call
|
|
240
|
+
return args if args.is_a?(String)
|
|
241
|
+
|
|
242
|
+
# The tool's name is already in the entry and nil fields say nothing:
|
|
243
|
+
# the cut should keep what the call asked for.
|
|
244
|
+
args = args.compact.except(:name, "name") if args.is_a?(Hash)
|
|
245
|
+
JSON.generate(args)
|
|
246
|
+
rescue StandardError
|
|
247
|
+
args.to_s
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def cut(text, limit)
|
|
251
|
+
text = text.to_s
|
|
252
|
+
text.length > limit ? "#{text[0, limit]}…" : text
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# The ask, on its own thread. Nothing reads the answer: the turn and the
|
|
256
|
+
# card are what they are with the judgment off.
|
|
257
|
+
def ask_progress(ctx)
|
|
258
|
+
return unless @declared
|
|
259
|
+
|
|
260
|
+
state = @mutex.synchronize do
|
|
261
|
+
state = { prompt: @prompt, calls: @count, elapsed_s: (monotonic - @started).round, tools: @calls_since.dup }
|
|
262
|
+
@calls_since = []
|
|
263
|
+
@calls_bytes = 0
|
|
264
|
+
state
|
|
265
|
+
end
|
|
266
|
+
run = ctx.judge_later(PROGRESS, state: state)
|
|
267
|
+
@mutex.synchronize { @run = run }
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
# What the user did with the card, saved on this turn's latest check-in's
|
|
271
|
+
# run: raw words, mapped only at analysis, since a Nudge asks for a status
|
|
272
|
+
# rather than a verdict and Keep going may be habit. A run that was never
|
|
273
|
+
# saved (the judgment off, no host) labels nothing.
|
|
274
|
+
def label(ctx, value, by: "card", strength: "weak")
|
|
275
|
+
return false unless @declared
|
|
276
|
+
|
|
277
|
+
ctx.judgments.label(@mutex.synchronize { @run }, value, by: by, strength: strength)
|
|
278
|
+
end
|
|
279
|
+
|
|
194
280
|
# --- /checkin --------------------------------------------------------------
|
|
195
281
|
|
|
196
282
|
def command(args, ctx)
|
|
@@ -262,6 +348,7 @@ class Plugin
|
|
|
262
348
|
end
|
|
263
349
|
|
|
264
350
|
@mutex.synchronize { @nudge = { text: text, count: count } }
|
|
351
|
+
label(ctx, "nudge") if card_open?
|
|
265
352
|
close_card(ctx, "Nudged the model at #{count} tool calls.")
|
|
266
353
|
nil
|
|
267
354
|
end
|
|
@@ -270,12 +357,14 @@ class Plugin
|
|
|
270
357
|
at = @mutex.synchronize { @next_at }
|
|
271
358
|
return "check-in: no check-in open" unless close_card(ctx, "Kept going; the next check-in is at #{at} tool calls.")
|
|
272
359
|
|
|
360
|
+
label(ctx, "keep_going")
|
|
273
361
|
nil
|
|
274
362
|
end
|
|
275
363
|
|
|
276
364
|
def stop(ctx)
|
|
277
365
|
return "check-in: no turn running" unless ctx.stop_turn("stopped from check-in")
|
|
278
366
|
|
|
367
|
+
label(ctx, "stop") if card_open?
|
|
279
368
|
close_card(ctx, "Stopped the turn at #{calls} tool calls.")
|
|
280
369
|
nil
|
|
281
370
|
end
|
|
@@ -300,7 +389,7 @@ class Plugin
|
|
|
300
389
|
def read_state(ctx, id)
|
|
301
390
|
return {} unless id
|
|
302
391
|
|
|
303
|
-
data = JSON.parse(File.read(
|
|
392
|
+
data = JSON.parse(File.read(state_file(ctx)))
|
|
304
393
|
data.is_a?(Hash) ? data : {}
|
|
305
394
|
rescue SystemCallError, JSON::ParserError
|
|
306
395
|
{}
|
|
@@ -311,8 +400,7 @@ class Plugin
|
|
|
311
400
|
id = ctx.session_id
|
|
312
401
|
return unless id
|
|
313
402
|
|
|
314
|
-
path =
|
|
315
|
-
FileUtils.mkdir_p(File.dirname(path))
|
|
403
|
+
path = state_file(ctx)
|
|
316
404
|
temp = "#{path}.#{Process.pid}.tmp"
|
|
317
405
|
File.write(temp, JSON.generate({ "enabled" => @enabled, "mode" => @mode, "after" => @after, "every" => @every }))
|
|
318
406
|
File.rename(temp, path)
|
|
@@ -320,12 +408,14 @@ class Plugin
|
|
|
320
408
|
ctx.log.warn("check_in_state_not_saved", msg: e.message) if ctx.respond_to?(:log)
|
|
321
409
|
end
|
|
322
410
|
|
|
323
|
-
def
|
|
411
|
+
def state_file(ctx) = File.join(ctx.session_dir, "state.json")
|
|
324
412
|
|
|
325
413
|
# --- helpers ---------------------------------------------------------------
|
|
326
414
|
|
|
327
415
|
def calls = @mutex.synchronize { @count }
|
|
328
416
|
|
|
417
|
+
def card_open? = @mutex.synchronize { @card_open }
|
|
418
|
+
|
|
329
419
|
def message(count) = @message.gsub("{calls}", count.to_s)
|
|
330
420
|
|
|
331
421
|
def elapsed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: claude-peer
|
|
3
|
-
version: 0.4.
|
|
3
|
+
version: 0.4.7
|
|
4
4
|
scope: system
|
|
5
5
|
description: "Pair this session with a Claude Code session you work with: the claude_send tool and /claude send it a part of the work (a plan step, a diff, a finding) to validate or as context, and Claude's answer comes back as the claude-outbox context; /claude install-skill installs Claude's chi-peer skill, which pairs"
|
|
6
6
|
trust_level: reviewed
|
|
@@ -10,9 +10,9 @@ files:
|
|
|
10
10
|
description: "Send a part of the work to the paired Claude Code session (claude_send): only when the user asks, or to reply to its answer in a peer turn; validate, context or question; Claude's answer comes as the claude-outbox context"
|
|
11
11
|
plugin:
|
|
12
12
|
file: plugin.rb
|
|
13
|
-
sha256: sha256:
|
|
13
|
+
sha256: sha256:1e730c4d0531f46181a714b9d7715290e4b37d2ea93de334a08eba66ebd5e027
|
|
14
14
|
scripts:
|
|
15
|
-
pair: sha256:
|
|
15
|
+
pair: sha256:d85023acf109ca61eabbdec2dc3ad452da84493b604643cb1006d9f21958f5bc
|
|
16
16
|
chi-peer-SKILL.md: sha256:e279f484f21833180f5328f8a775d96d6a09fc2f8a02063a1d30ead2eaf365ca
|
|
17
17
|
# The plugin needs Samagotchi::Plugin::Peer and chi.peer_source (chi 0.67.0).
|
|
18
18
|
# An agreeing answer's closing wake (the skills say an OK wakes chi once)
|
|
@@ -5,7 +5,7 @@ require "json"
|
|
|
5
5
|
require "socket"
|
|
6
6
|
require "samagotchi/plugin/peer"
|
|
7
7
|
|
|
8
|
-
# claude-peer (docs/
|
|
8
|
+
# claude-peer (docs/bundles.md, The claude-peer bundle): a live link between
|
|
9
9
|
# this chi session and a Claude Code session the user works with. Claude
|
|
10
10
|
# pairs (its chi-peer skill, scripts/pair): it attaches the `claude-inbox`
|
|
11
11
|
# context, whose hint is its per-session inbox socket
|