rubik 0.8.1 → 0.9.1
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/ATTRIBUTION.md +2 -2
- data/CHANGELOG.md +207 -43
- data/README.md +5 -1
- data/bin/rubik +15 -10
- data/lib/rubik/adapter/base.rb +19 -0
- data/lib/rubik/adapter/generic.rb +0 -14
- data/lib/rubik/adapter/node.rb +2 -0
- data/lib/rubik/ast/treesitter/zig_walker.rb +15 -2
- data/lib/rubik/cli/workspace_trust.rb +17 -0
- data/lib/rubik/concurrency/worker.rb +143 -0
- data/lib/rubik/concurrency.rb +1 -0
- data/lib/rubik/config/deep_ops.rb +17 -0
- data/lib/rubik/config/defaults.rb +23 -1
- data/lib/rubik/config/schema.rb +0 -1
- data/lib/rubik/config/store.rb +14 -0
- data/lib/rubik/config.rb +7 -3
- data/lib/rubik/context/repo_context_reader.rb +27 -8
- data/lib/rubik/events.rb +18 -0
- data/lib/rubik/kernel/dispatcher.rb +4 -4
- data/lib/rubik/kernel/unit.rb +4 -3
- data/lib/rubik/log.rb +2 -1
- data/lib/rubik/lsp/client.rb +83 -180
- data/lib/rubik/lsp/document_store.rb +209 -0
- data/lib/rubik/mcp/client.rb +4 -3
- data/lib/rubik/mcp/manager.rb +6 -2
- data/lib/rubik/mcp/transport/stdio.rb +51 -9
- data/lib/rubik/orchestrator/auto_apply.rb +2 -0
- data/lib/rubik/orchestrator/budget_manager.rb +18 -2
- data/lib/rubik/orchestrator/goal_ledger/deep_ops.rb +41 -0
- data/lib/rubik/orchestrator/goal_ledger/drift.rb +2 -1
- data/lib/rubik/orchestrator/goal_ledger/ledger.rb +56 -50
- data/lib/rubik/orchestrator/goal_ledger/observation_projection.rb +26 -0
- data/lib/rubik/orchestrator/goal_ledger/patch.rb +10 -17
- data/lib/rubik/orchestrator/goal_ledger/suspend_lifecycle.rb +9 -41
- data/lib/rubik/orchestrator/goal_ledger/validator.rb +6 -20
- data/lib/rubik/orchestrator/goal_ledger/verifier.rb +3 -14
- data/lib/rubik/orchestrator/goal_ledger/xml_render.rb +21 -14
- data/lib/rubik/orchestrator/goal_session.rb +505 -0
- data/lib/rubik/orchestrator/goal_state.rb +15 -15
- data/lib/rubik/orchestrator/loop.rb +62 -63
- data/lib/rubik/orchestrator/lsp_feedback.rb +7 -1
- data/lib/rubik/orchestrator/subagent/admission_policy.rb +161 -0
- data/lib/rubik/orchestrator/subagent/builtin_types.rb +3 -2
- data/lib/rubik/orchestrator/subagent/instance.rb +4 -0
- data/lib/rubik/orchestrator/subagent/journal.rb +2 -1
- data/lib/rubik/orchestrator/subagent/notices.rb +5 -4
- data/lib/rubik/orchestrator/subagent/profile_contract.rb +4 -10
- data/lib/rubik/orchestrator/subagent/questioner.rb +21 -6
- data/lib/rubik/orchestrator/subagent/run_cycle.rb +22 -1
- data/lib/rubik/orchestrator/subagent/scoped_registry.rb +34 -2
- data/lib/rubik/orchestrator/subagent/step_runner.rb +1 -1
- data/lib/rubik/orchestrator/subagent/teardown.rb +4 -0
- data/lib/rubik/orchestrator/subagent/transcript_formatter.rb +2 -1
- data/lib/rubik/orchestrator/subagent/type_registry.rb +19 -1
- data/lib/rubik/orchestrator/turn_executor/subagent_channel.rb +6 -1
- data/lib/rubik/orchestrator/turn_executor/user_channel.rb +6 -1
- data/lib/rubik/orchestrator/turn_executor.rb +2 -1
- data/lib/rubik/orchestrator.rb +1 -0
- data/lib/rubik/platform/path.rb +0 -1
- data/lib/rubik/platform.rb +15 -0
- data/lib/rubik/plugin/storage.rb +20 -29
- data/lib/rubik/prompt/context_builder.rb +24 -18
- data/lib/rubik/prompt/context_compactor.rb +31 -8
- data/lib/rubik/prompt/conversation_rows.rb +33 -0
- data/lib/rubik/prompt/doctrine.rb +4 -2
- data/lib/rubik/prompt/emergency_compactor.rb +5 -4
- data/lib/rubik/repl/commands/agent_context.rb +1 -1
- data/lib/rubik/repl/commands/agent_execution.rb +15 -467
- data/lib/rubik/repl/commands/buffer.rb +5 -1
- data/lib/rubik/repl/commands/lsp.rb +1 -1
- data/lib/rubik/repl/commands/mcp.rb +5 -0
- data/lib/rubik/repl/commands/subagents.rb +4 -4
- data/lib/rubik/repl/commands/workspace.rb +22 -2
- data/lib/rubik/repl/config_wiring.rb +24 -7
- data/lib/rubik/repl/input_execution.rb +1 -1
- data/lib/rubik/repl/input_loop.rb +1 -1
- data/lib/rubik/repl/lifecycle.rb +31 -2
- data/lib/rubik/repl/pruner/harness.rb +52 -67
- data/lib/rubik/repl/pruner/rules.rb +3 -1
- data/lib/rubik/repl/service_catalog.rb +1 -1
- data/lib/rubik/repl/synthesized_command_context.rb +3 -0
- data/lib/rubik/repl/turn_recorder.rb +5 -4
- data/lib/rubik/repl.rb +1 -0
- data/lib/rubik/runtime/context.rb +5 -0
- data/lib/rubik/runtime/discovery.rb +55 -0
- data/lib/rubik/runtime/manifest_store.rb +116 -0
- data/lib/rubik/runtime/overlay_storage.rb +300 -218
- data/lib/rubik/runtime/repair_probe.rb +20 -2
- data/lib/rubik/runtime/sealed_coeffects.rb +58 -0
- data/lib/rubik/runtime/synthesized_command_context.rb +80 -0
- data/lib/rubik/runtime/synthesized_tool_context.rb +123 -0
- data/lib/rubik/runtime/task_manager.rb +7 -2
- data/lib/rubik/runtime.rb +3 -0
- data/lib/rubik/security/allowlist.rb +167 -0
- data/lib/rubik/security/audit_log.rb +72 -0
- data/lib/rubik/security/classifier/classifier.rb +24 -8
- data/lib/rubik/security/classifier/commands/biome.yaml +49 -0
- data/lib/rubik/security/classifier/commands/bun.yaml +91 -0
- data/lib/rubik/security/classifier/commands/bundle.yaml +107 -0
- data/lib/rubik/security/classifier/commands/clang-format.yaml +21 -0
- data/lib/rubik/security/classifier/commands/clang.yaml +37 -0
- data/lib/rubik/security/classifier/commands/cmake.yaml +37 -0
- data/lib/rubik/security/classifier/commands/ctest.yaml +30 -0
- data/lib/rubik/security/classifier/commands/gcc.yaml +36 -0
- data/lib/rubik/security/classifier/commands/gem.yaml +104 -0
- data/lib/rubik/security/classifier/commands/gofmt.yaml +15 -0
- data/lib/rubik/security/classifier/commands/pnpm.yaml +8 -8
- data/lib/rubik/security/classifier/commands/python.yaml +18 -1
- data/lib/rubik/security/classifier/commands/python3.yaml +18 -1
- data/lib/rubik/security/classifier/commands/rake.yaml +60 -0
- data/lib/rubik/security/classifier/commands/rspec.yaml +42 -0
- data/lib/rubik/security/classifier/commands/rubocop.yaml +38 -0
- data/lib/rubik/security/classifier/commands/ruby.yaml +25 -0
- data/lib/rubik/security/classifier/commands/rustc.yaml +34 -0
- data/lib/rubik/security/classifier/commands/zig.yaml +77 -0
- data/lib/rubik/security/classifier/database.rb +12 -1
- data/lib/rubik/security/classifier/matcher.rb +17 -2
- data/lib/rubik/security/classifier/models.rb +3 -2
- data/lib/rubik/security/classifier.rb +5 -0
- data/lib/rubik/security/command_gate.rb +567 -0
- data/lib/rubik/security/guard.rb +96 -989
- data/lib/rubik/security/path_policy.rb +117 -0
- data/lib/rubik/security/synthesis_gate.rb +300 -0
- data/lib/rubik/security.rb +5 -0
- data/lib/rubik/storage/ranking.rb +113 -0
- data/lib/rubik/storage/store.rb +2 -92
- data/lib/rubik/storage/transcript_indexer.rb +2 -3
- data/lib/rubik/storage/vakanuvis/harness.rb +49 -89
- data/lib/rubik/tools/base.rb +24 -7
- data/lib/rubik/tools/builtins/files.rb +2 -0
- data/lib/rubik/tools/builtins/goal_ledger.rb +9 -9
- data/lib/rubik/tools/builtins/grep.rb +2 -3
- data/lib/rubik/tools/builtins/lifecycle.rb +91 -88
- data/lib/rubik/tools/builtins/synthesis.rb +124 -64
- data/lib/rubik/tools/builtins/unsynthesize.rb +38 -0
- data/lib/rubik/tools/catalog.rb +3 -0
- data/lib/rubik/tools/declaration.rb +6 -2
- data/lib/rubik/tools/lifecycle_rollbacks.rb +87 -0
- data/lib/rubik/tools/native_search.rb +2 -1
- data/lib/rubik/tools/preflight_runner.rb +107 -14
- data/lib/rubik/tools/registry.rb +2 -0
- data/lib/rubik/tools/truncator.rb +25 -0
- data/lib/rubik/tools/uri_resolver.rb +3 -1
- data/lib/rubik/uris.rb +5 -1
- data/lib/rubik/version.rb +1 -1
- data/lib/rubik.rb +1 -0
- metadata +35 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4978b3f5f55209ac3558f5d2a82651b0e9f2d56571ebb33cb65a8b488f2689b0
|
|
4
|
+
data.tar.gz: 4b430b94ecdc22c7f5b75756f9bd23f0eadf544a0ecf760c8fa5a8c14c99bcc0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: acf9faccdcfdb6a344bfc3e1aa8b7f3c316d42a14b6c65766bf2d9b9c728378a312022c7b4195542abeb62fd7319af72d17cd207ec3b69435cbaa8d807bac94b
|
|
7
|
+
data.tar.gz: 88b8c7bd853a932860ad009a06e9f3e1b505e72049d4b09ac911f07fa0ecdaf6320b145dd1f67e2b48488c02fff4dae2b3562806e1b0601bf2e59c3c74233924
|
data/ATTRIBUTION.md
CHANGED
|
@@ -13,7 +13,7 @@ Rubik is built on the shoulders of giants. This document acknowledges and credit
|
|
|
13
13
|
- **License:** MIT License
|
|
14
14
|
- **Rubik Integration:**
|
|
15
15
|
- Ported to pure Ruby under [`lib/rubik/security/classifier/`](lib/rubik/security/classifier/).
|
|
16
|
-
- Includes the comprehensive command database (
|
|
16
|
+
- Includes the comprehensive command database (191 popular CLI tool definition YAML files under [`lib/rubik/security/classifier/commands/`](lib/rubik/security/classifier/commands/)).
|
|
17
17
|
- Adapted to use `tree-sitter` for AST parsing, and extended with first-class **PowerShell** (`pwsh`) cmdlet risk classification and execution policy checking.
|
|
18
18
|
|
|
19
19
|
```
|
|
@@ -121,7 +121,7 @@ SOFTWARE.
|
|
|
121
121
|
| **`strings-ansi`** | Piotr Murach | MIT | ANSI-aware string truncation and alignment for REPL formatters. |
|
|
122
122
|
| **`reline`** | Hiroshi SHIBATA & Ruby Team | Ruby License / BSD-2-Clause | Line-editing, history navigation, autocompletion hooks, and headless terminal adaptation. |
|
|
123
123
|
| **`prism`** | Kevin Newton & Ruby Core Team | MIT | High-performance Ruby parsing and AST extraction ([`Rubik::AST::RubyExtractor`](lib/rubik/ast/ruby_extractor.rb)). |
|
|
124
|
-
| **`minitest`** | Ryan Davis & seattlerb | MIT | Fast, modular test suite powering Rubik's 4,
|
|
124
|
+
| **`minitest`** | Ryan Davis & seattlerb | MIT | Fast, modular test suite powering Rubik's 4,400+ unit, integration, and contract tests. |
|
|
125
125
|
| **`rubocop`** | Bozhidar Batsov & contributors | MIT | Static code analysis, style enforcement, and architectural hygiene gates. |
|
|
126
126
|
| **`benchmark`, `logger`, `pstore`, `reline`, `fiddle`** | Ruby core / rubygems teams | Ruby License / BSD-2-Clause | Ruby stdlib gems pinned explicitly in `rubik.gemspec` as they are unbundled from the default set in Ruby 3.4/3.5. |
|
|
127
127
|
|
data/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,210 @@ commits, 2026-08-23 → 2026-10-09, see `git log`).
|
|
|
6
6
|
|
|
7
7
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
8
8
|
|
|
9
|
-
## [
|
|
9
|
+
## [0.9.1] - 2026-11-14
|
|
10
|
+
|
|
11
|
+
The hardening-and-single-homing patch: overlay commands seal their default
|
|
12
|
+
wrap and compare manifest hashes in constant time, the Guard god-file splits
|
|
13
|
+
into five deep modules with the allowlist gates failing closed, MCP stdio
|
|
14
|
+
spawns get host-runtime scrubbing and a per-server credential policy, the
|
|
15
|
+
parallel-stable test gate retires the capacity-flake adjudication burden
|
|
16
|
+
(#384) — and the single-homing wave collapses duplicated logic across the
|
|
17
|
+
BM25 ranker, LSP document store, goal session, preview truncation, and the
|
|
18
|
+
overlay kind adapter.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **MCP stdio credential policy (#429):** MCP stdio servers keep inheriting the
|
|
23
|
+
host environment (minus the bundler/Ruby runtime variables the spawn-hygiene
|
|
24
|
+
scrub already unsets) — a non-breaking default, since many real servers
|
|
25
|
+
legitimately need operator credentials. A per-server `inherit_env:` option
|
|
26
|
+
(default `true`) opts out: with `inherit_env: false`, variables matching
|
|
27
|
+
`/_(API_KEY|TOKEN|SECRET|PASSWORD)$/` (case-insensitive) are additionally
|
|
28
|
+
unset for that server's subprocess, leaving the sanitized base plus only its
|
|
29
|
+
explicit `env:` entries. Explicit `env:` entries always win in both modes.
|
|
30
|
+
The policy is documented in `docs/reference/environment.md`, the README
|
|
31
|
+
security notes, and the workspace-trust notice.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **Guard split into five deep modules (#413):** `AuditLog`, `PathPolicy`,
|
|
36
|
+
`Allowlist`, `CommandGate`, and `SynthesisGate` each own one security
|
|
37
|
+
concern while `Guard` stays the delegating composition root (explicit
|
|
38
|
+
delegating defs, no `method_missing`); historical `Guard::` constants
|
|
39
|
+
alias to the owning module, and every security-sensitive move is
|
|
40
|
+
verbatim.
|
|
41
|
+
- **Allowlist matching and its fail-closed valve single-homed (#401,
|
|
42
|
+
#425):** the token-prefix match collapses behind one `allowlist_match_argv?`
|
|
43
|
+
core feeding both AST and raw paths, the four verbatim fail-closed
|
|
44
|
+
allowlist evaluations in CommandGate delegate to one helper with identical
|
|
45
|
+
deny semantics, `Classifier::Engine.builtin_dangerous?` becomes the public
|
|
46
|
+
predicate, and the dead `DANGEROUS_SYSTEM_ROOTS` constant is deleted.
|
|
47
|
+
- **Overlay command/tool quadruplets parameterized behind a Kind adapter
|
|
48
|
+
(#419):** save/delete/load collapse onto shared skeletons with the 22
|
|
49
|
+
public methods unchanged, the corrupt-manifest fail-closed contract is
|
|
50
|
+
single-homed, and byte-exact header emission is pinned by new tests.
|
|
51
|
+
- **LSP DocumentStore extracted (#418):** the four per-document hashes and
|
|
52
|
+
the three hand-rolled restore-on-failed-send rollbacks collapse into one
|
|
53
|
+
snapshot/restore helper; the lock-order invariant is single-homed and
|
|
54
|
+
the `did_close`/`did_change` failed-send restore coverage gaps are
|
|
55
|
+
closed.
|
|
56
|
+
- **GoalSession extracted from agent_execution (#414):** the 21 `!goal`
|
|
57
|
+
lifecycle methods move byte-identical into `Orchestrator::GoalSession`
|
|
58
|
+
and the duplicated goal-shaped orchestrator-loop stanza folds into one
|
|
59
|
+
builder; the command file shrinks 712 → 249 LOC.
|
|
60
|
+
- **BM25 ranking extracted into Storage::Ranking (#415):** the scored-search
|
|
61
|
+
math (Okapi scoring, field-tier bonuses, ordering) moves behind one pure
|
|
62
|
+
entry point with `Store#search_ranked` keeping its exact contract; the
|
|
63
|
+
dead backward-compat hash branch is dropped.
|
|
64
|
+
- **Preview truncation markers single-homed in Truncator (#402):** six
|
|
65
|
+
modules carrying three drifting marker spellings delegate to new
|
|
66
|
+
`clip`/`clip_line` homes with byte-for-byte legacy output pinned.
|
|
67
|
+
- **Questioner poll replaced with a condition variable (#434):** the 100 ms
|
|
68
|
+
answer poll becomes an unsynchronized-free condition-variable wake, the
|
|
69
|
+
lifecycle repair tool's `execute` splits into discover/verify/promote
|
|
70
|
+
phases (#435), and plugin/overlay integrity records share one manifest
|
|
71
|
+
store (#436).
|
|
72
|
+
- **Parallel-stable test gate (#417):** `rake test:parallel:stable` and
|
|
73
|
+
`rake test:stable` select the timing-insensitive subset (383 of 404
|
|
74
|
+
unit files), parallel runs export `RUBIK_TEST_PERF_RELAX=1` so the
|
|
75
|
+
wall-clock budgets degrade to report-only warns, and bounded `wait_until`
|
|
76
|
+
waits replace raw sleeps — closing #384.
|
|
77
|
+
- **Toolchain bumps (#420, #422):** `tree_sitter_language_pack` 1.25.0
|
|
78
|
+
(with the ZigWalker teaching both grammar spellings across the pack
|
|
79
|
+
range) and `prism` 2.1.0.
|
|
80
|
+
- **Reference docs refreshed (#433):** `RUBIK_TRUST_WORKSPACE` and
|
|
81
|
+
`RUBIK_TEST_ROOT` join the environment table, and a stray duplicated
|
|
82
|
+
0.7.1 changelog block is removed.
|
|
83
|
+
|
|
84
|
+
### Fixed
|
|
85
|
+
|
|
86
|
+
- **MCP stdio spawn hygiene (#424):** stdio servers no longer inherit the
|
|
87
|
+
host bundler/Ruby runtime variables; the LSP scrub single-homes as
|
|
88
|
+
`Rubik::Platform.sanitized_spawn_env` with explicitly configured `env:`
|
|
89
|
+
entries merging on top and winning.
|
|
90
|
+
- **Overlay integrity comparisons (#431):** overlay manifest hashes are
|
|
91
|
+
compared in constant time via the same `secure_compare` helper the
|
|
92
|
+
plugin packages already used.
|
|
93
|
+
- **Probe-shape tokenization fails closed (#430):** a quote-corrupted
|
|
94
|
+
command can no longer tokenize as a read-only probe and ride the
|
|
95
|
+
safe-probe exemption; the fallback yields nil and the gate denies.
|
|
96
|
+
- **TaskManager guard fallback and adapter sink validation (#410):** a
|
|
97
|
+
TaskManager constructed without a Guard falls back to a fresh fail-closed
|
|
98
|
+
one, and custom test/format adapter commands are validated through the
|
|
99
|
+
guard at execution sinks, closing the promotion TOCTOU.
|
|
100
|
+
- **Default overlay command wrap sealed (#412):** bare-body overlay
|
|
101
|
+
commands wrap into a sealed 2-arity handler on the deny-list path, and
|
|
102
|
+
the arity-3 raw-shell trust model is documented at both sites.
|
|
103
|
+
- **Boot-time config warnings surfaced (#411):** accumulated config
|
|
104
|
+
warnings print once per boot through the REPL notices seam with a
|
|
105
|
+
mirrored stderr `Log.warn`, and `RETIRED_KEYS` emits the tailored
|
|
106
|
+
`network.allow` deprecation.
|
|
107
|
+
- **Dispatcher failure logs carry the error class (#432)** so a subscriber
|
|
108
|
+
or dmesg failure says what failed, not just that it failed.
|
|
109
|
+
- **Bare rescues narrowed, LSP handshake failure logged (#400):** five
|
|
110
|
+
bare `rescue` clauses no longer swallow Ctrl-C, and `Client#start`
|
|
111
|
+
emits the handshake failure cause before stopping.
|
|
112
|
+
- **test-unit `omit` swapped for minitest `skip` (#416):** all 18
|
|
113
|
+
capability-guarded call sites would have raised `NoMethodError` the
|
|
114
|
+
moment their guard fired; now they skip.
|
|
115
|
+
|
|
116
|
+
## [0.9.0] - 2026-11-09
|
|
117
|
+
|
|
118
|
+
The permission-architecture minor: subagent command permissions, the
|
|
119
|
+
synthesis security gate, and tool visibility are overhauled end to end
|
|
120
|
+
(F1-F8 command classifier, trust discovery, sealed contexts, admission
|
|
121
|
+
policy), the goal-ledger aligns SKILL.state with arXiv:2608.26263, context
|
|
122
|
+
assembly hardens its budget boundaries and injection defense — and the
|
|
123
|
+
single-homing wave continues (bounded-queue worker, event-name vocabulary,
|
|
124
|
+
sigma-row grammar, sealed-context deny-list each collapse to one owner).
|
|
125
|
+
|
|
126
|
+
### Added
|
|
127
|
+
|
|
128
|
+
- **Subagent tool admission single-homed behind one policy (#393):** the
|
|
129
|
+
dynamic-origin vocabulary, risk ladder, per-plane rules, and capability
|
|
130
|
+
labels live in one `AdmissionPolicy` while the executor stays
|
|
131
|
+
`ScopedRegistry`; unknown planes raise at the boundary, every non-builtin
|
|
132
|
+
origin is ladder-gated on research/coder, a caller-provided `tool_filter`
|
|
133
|
+
is rejected up front (the installed-filter marker keeps re-registration
|
|
134
|
+
legal), and filter-less type_defs fail the label simulation loudly.
|
|
135
|
+
- **Subagent command permissions, synthesis security gate, and tool
|
|
136
|
+
visibility overhauled (#392):** the classifier command DB expands with 19
|
|
137
|
+
command families, workspace trust discovery and interactive approval land,
|
|
138
|
+
Ruby synthesis decouples from the shell classifier with
|
|
139
|
+
`SynthesizedCommandContext` sealed, preflight goes conditional, and the
|
|
140
|
+
2-arity sealed tool context arrives; the review round closed the sealed
|
|
141
|
+
`tool_registry`/`tools` escape, preflight verdict spoofing
|
|
142
|
+
(`exit!`/`SystemExit`/strict-boolean verdict), the nil-type_def silent
|
|
143
|
+
grant, and several silent downgrades that now warn.
|
|
144
|
+
- **Permission & authorization architecture hardening (F1-F8) (#391):**
|
|
145
|
+
synthesis forbidden capabilities block constant-aliasing escapes
|
|
146
|
+
(Kernel, File, ENV, ObjectSpace, Rubik, Fiber); `.rubik/**` joins
|
|
147
|
+
`Guard::DEFAULT_CRITICAL_PATTERNS` and untrusted project configs get
|
|
148
|
+
sensitive keys stripped; `RepairProbe` is confined to a diagnostic
|
|
149
|
+
whitelist behind `Guard#verify_command_safety!`; `rubik --trust` CLI flag
|
|
150
|
+
for trusted workspaces; `!mcp` mutating commands restricted for agent
|
|
151
|
+
callers; classifier Windows dangerous roots and HOME prefix detection
|
|
152
|
+
fixed with `critical_path?` verification on shell write paths; relative
|
|
153
|
+
traversal blocked in `BaseTool.normalize_path_filter`;
|
|
154
|
+
`buffer.model_can_apply` enforced with `!autoapply`/`!format` agent-caller
|
|
155
|
+
guards.
|
|
156
|
+
- **GoalLedger aligned with arXiv:2608.26263 (#389):** continuous
|
|
157
|
+
observation projection hooks `BudgetManager#evaluate_context_compaction!`
|
|
158
|
+
so banked tool observations are projected without waiting for ceiling
|
|
159
|
+
exhaustion, verbose assistant reasoning is pruned on banked calls,
|
|
160
|
+
deterministic RFC 6902 index attributes land on ledger list items,
|
|
161
|
+
`rubik://goal/ledger.json` exposes machine-readable state, `DeepOps#
|
|
162
|
+
deep_freeze` freezes in-place, and the declarative verification specs are
|
|
163
|
+
documented in system prompts.
|
|
164
|
+
|
|
165
|
+
### Changed
|
|
166
|
+
|
|
167
|
+
- **`network.allow` alias retired; buffer-sync writers derived from
|
|
168
|
+
Declarations (#397):** the deprecation listener names the
|
|
169
|
+
`sandbox.allow_network` replacement and SECURITY.md states honestly that
|
|
170
|
+
config-file entries are silently ignored; the LSP buffer-sync writer set
|
|
171
|
+
is derived from tool Declarations instead of a hand-maintained list.
|
|
172
|
+
- **Event-name vocabulary single-homed in a zero-require leaf (#396):**
|
|
173
|
+
`lib/rubik/events.rb` owns the bus event names; every emit/subscribe site
|
|
174
|
+
uses the shared symbols so names cannot drift from their single home.
|
|
175
|
+
- **Bounded-queue worker skeleton single-homed (#395):** atomic admission,
|
|
176
|
+
idempotent shutdown, busy accounting, and the guarded dispatch-failure net
|
|
177
|
+
live in `Rubik::Concurrency::Worker`; pruner and vakanuvis harnesses
|
|
178
|
+
migrate onto it.
|
|
179
|
+
- **Sigma-row grammar single home; verifier seam narrowed (#388):**
|
|
180
|
+
`GOAL_LEDGER_TAG`/`LEDGER_DRIFT_TAG` live in the prompt layer (consumed by
|
|
181
|
+
XmlRender, DriftNote, the injection-escape site, and the new
|
|
182
|
+
`drift_message?` predicate), the ledger's byte-for-byte reimplementations
|
|
183
|
+
are deleted, and `Verifier.at_step_boundary!` speaks values instead of
|
|
184
|
+
reaching through the loop object.
|
|
185
|
+
- **Max-steps terminal carries a structured reason (#387):** `reason:
|
|
186
|
+
:budget_exhausted` on the terminal hash; both consumers (goal
|
|
187
|
+
auto-continue, ask-continue) branch on the symbol instead of
|
|
188
|
+
substring-matching the English prose, so rewording can no longer dead the
|
|
189
|
+
`agent.goal_auto_continue_limit` knob.
|
|
190
|
+
- **Goal-ledger copy families consolidated (#385):** `stamp_row!`, a shared
|
|
191
|
+
`DeepOps` page, schema-derived seed/snapshot/load-check with a tripwire
|
|
192
|
+
test, and `Ledger.load` give the stamp, deep-copy discipline, and sigma
|
|
193
|
+
vocabulary single owners; dead `Verifier.stale?` and `Patch#raw_bytesize`
|
|
194
|
+
deleted; five degradation pins kept green through the refactor.
|
|
195
|
+
|
|
196
|
+
### Fixed
|
|
197
|
+
|
|
198
|
+
- **Context assembly, budget boundaries, and injection defense hardened
|
|
199
|
+
(F1-F9) (#390):** tool schema tokens reserved in compaction with unified
|
|
200
|
+
max_output_tokens resolution; dynamic system prompt fingerprinting with
|
|
201
|
+
in-place refresh on tool/skill/subagent changes; protocol files capped
|
|
202
|
+
(highest priority only, 8k tokens) with closing-tag sanitization; XML
|
|
203
|
+
escaping in custom command rendering; LSP diagnostics capped at 50 with
|
|
204
|
+
error-first priority; 'self' subagent inherits protocol XML and the
|
|
205
|
+
environment line; `sanitize_dialogue_turn` validates roles and neutralizes
|
|
206
|
+
unescaped pin tags from prior turns; `SystemCallError`/`EncodingError`
|
|
207
|
+
handled in git branch detection.
|
|
208
|
+
- **Suspend tokens assigned absolutely and reported honestly (#386):** the
|
|
209
|
+
transient-ClientError rescue passes real `orchestrator.total_tokens` into
|
|
210
|
+
the suspended terminal (was zero), `GoalState#suspend!` assigns absolutely
|
|
211
|
+
instead of additive `+=` so suspend→resume→suspend no longer
|
|
212
|
+
double-counts, and dead `GoalState#record_tokens!` is deleted.
|
|
10
213
|
|
|
11
214
|
## [0.8.1] - 2026-11-06
|
|
12
215
|
|
|
@@ -167,47 +370,6 @@ anyway.
|
|
|
167
370
|
class; the mapping is byte-identical (backslash doubles, pipe gains a
|
|
168
371
|
backslash) and truncation can no longer split an escape sequence.
|
|
169
372
|
|
|
170
|
-
## [0.7.1] - 2026-11-04
|
|
171
|
-
the RECALL_* policy constants moved out of the Harness thread core into
|
|
172
|
-
a pure Recall module - Harness#recall is now a one-line delegate, the
|
|
173
|
-
verbatim first_body_line duplication between Harness and Orientation is
|
|
174
|
-
gone, and Orientation/DistillGate no longer reach into Harness constants.
|
|
175
|
-
|
|
176
|
-
- **Tool-output normalization single-homed:** the root StepExecutor and the
|
|
177
|
-
subagent ToolDispatch each carried a private copy of the carrier
|
|
178
|
-
classification (Result / status-duck / raw string), the error-prefix
|
|
179
|
-
lexicon and the truncation-knob fetch. Both planes now delegate to
|
|
180
|
-
`Rubik::Tools::ResultNormalizer`; the parity suite stays as anti-drift
|
|
181
|
-
insurance and a non-fetchable config object now warns once instead of
|
|
182
|
-
silently dropping operator-set truncation limits. Subagent-plane edge
|
|
183
|
-
cases (blank error first line, error?/failed? precedence) unified onto
|
|
184
|
-
the root behavior, pinned by tests.
|
|
185
|
-
|
|
186
|
-
- **Tool plane membership declared on the tool:** ScopedRegistry's
|
|
187
|
-
hand-maintained `ROOT_ONLY_TOOLS` / `BUFFER_BOUND_TOOLS` name lists now
|
|
188
|
-
project from the tools' own `Declaration`s (`root_only:`, `buffer_bound:`)
|
|
189
|
-
via `Catalog` — the same declaration→projection pattern the archetype
|
|
190
|
-
allowlists, spawn set, write gate and maestro gate already use.
|
|
191
|
-
|
|
192
|
-
### Fixed
|
|
193
|
-
|
|
194
|
-
- **Strict typed schema enforcement:** `Config#set`, `Scoped#set`, and
|
|
195
|
-
`Scoped` constructor overrides now reject values that violate
|
|
196
|
-
`Schema::DEFINITIONS` (previously the validation result was ignored —
|
|
197
|
-
e.g. `set("agent.max_steps", 0)` was silently accepted). The per-key
|
|
198
|
-
prompt-grace escape hatch is gone; the schema is the single validation
|
|
199
|
-
authority, including whole-section writes (nested leaves are coerced
|
|
200
|
-
first) and boot-time merged-tree validation. The stale
|
|
201
|
-
`buffer.auto_apply` enum gained the documented `on_test`/`on_finish`
|
|
202
|
-
modes, `sandbox.driver` became free-form (the driver registry is
|
|
203
|
-
plugin-extensible), and `tools.call_timeout` accepts `0` as its
|
|
204
|
-
documented off value.
|
|
205
|
-
- **Phantom legacy env mappings removed:** six `LEGACY_MAP` entries pointed
|
|
206
|
-
at config keys no consumer reads (their real consumers read ENV
|
|
207
|
-
directly), so their deprecation advice was false and the mapped values
|
|
208
|
-
tripped "Unknown config key" warnings. Only config-backed legacy
|
|
209
|
-
variables remain.
|
|
210
|
-
|
|
211
373
|
## [0.7.1] - 2026-11-04
|
|
212
374
|
|
|
213
375
|
An LSP maturity patch: the language-server integration comes back from
|
|
@@ -1367,7 +1529,9 @@ installation section.
|
|
|
1367
1529
|
- Context: serialized index mutations, snapshot-outside-lock reconcile,
|
|
1368
1530
|
streaming-first truncation.
|
|
1369
1531
|
|
|
1370
|
-
[Unreleased]: https://github.com/ozgurulukir/rubik/compare/v0.
|
|
1532
|
+
[Unreleased]: https://github.com/ozgurulukir/rubik/compare/v0.9.1...HEAD
|
|
1533
|
+
[0.9.1]: https://github.com/ozgurulukir/rubik/compare/v0.9.0...v0.9.1
|
|
1534
|
+
[0.9.0]: https://github.com/ozgurulukir/rubik/compare/v0.8.1...v0.9.0
|
|
1371
1535
|
[0.8.1]: https://github.com/ozgurulukir/rubik/compare/v0.8.0...v0.8.1
|
|
1372
1536
|
[0.8.0]: https://github.com/ozgurulukir/rubik/compare/v0.7.1...v0.8.0
|
|
1373
1537
|
[0.7.1]: https://github.com/ozgurulukir/rubik/compare/v0.7.0...v0.7.1
|
data/README.md
CHANGED
|
@@ -125,7 +125,11 @@ a dependency from source; see the [installation guide](docs/how-to/installation.
|
|
|
125
125
|
12. **Extensions · MCP servers.** Connect external stdio servers and expose
|
|
126
126
|
discovered tools through Rubik's registry. Lifecycle cleanup removes proxy
|
|
127
127
|
tools and attempts to stop child processes when the server is disconnected.
|
|
128
|
-
|
|
128
|
+
Spawn commands pass the same Guard gate as agent commands; servers inherit
|
|
129
|
+
the host environment (minus bundler/Ruby runtime variables) by default, and
|
|
130
|
+
a per-server `inherit_env: false` opts out of forwarding credential-shaped
|
|
131
|
+
variables. See [MCP commands](docs/reference/commands.md) and the
|
|
132
|
+
[environment reference](docs/reference/environment.md).
|
|
129
133
|
13. **Recovery · Live service repair.** Inspect runtime state, verify a
|
|
130
134
|
replacement command in a disposable context, then promote it without
|
|
131
135
|
restarting the process. Failed promotion or persistence unwinds session
|
data/bin/rubik
CHANGED
|
@@ -13,7 +13,7 @@ require "optparse"
|
|
|
13
13
|
# inner handler has been left uninstalled -- always terminates the process, so
|
|
14
14
|
# the user is never stuck unable to exit.
|
|
15
15
|
trap("INT") do
|
|
16
|
-
|
|
16
|
+
warn "\n[rubik] Interrupted. Exiting."
|
|
17
17
|
exit!(130)
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -52,6 +52,10 @@ OptionParser.new do |opts|
|
|
|
52
52
|
options[:script] = file
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
opts.on("--trust", "Explicitly trust the current workspace") do
|
|
56
|
+
options[:trust] = true
|
|
57
|
+
end
|
|
58
|
+
|
|
55
59
|
opts.on("--no-color", "Disable ANSI colors, banner and spinner") do
|
|
56
60
|
ENV["NO_COLOR"] = "1"
|
|
57
61
|
end
|
|
@@ -61,21 +65,22 @@ OptionParser.new do |opts|
|
|
|
61
65
|
end
|
|
62
66
|
end.parse!
|
|
63
67
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
Rubik::CLI::WorkspaceTrust.trust!(Dir.pwd) if options[:trust]
|
|
69
|
+
|
|
70
|
+
workspace_trusted = options[:trust] ||
|
|
71
|
+
options[:script] ||
|
|
72
|
+
Rubik::CLI::WorkspaceTrust.authorize!(
|
|
73
|
+
workspace: Dir.pwd,
|
|
74
|
+
input: $stdin,
|
|
75
|
+
output: $stdout
|
|
76
|
+
)
|
|
70
77
|
Kernel.exit(0) unless workspace_trusted
|
|
71
78
|
|
|
72
79
|
shell = Rubik::REPL::Shell.new
|
|
73
80
|
|
|
74
81
|
if options[:continue]
|
|
75
82
|
res = shell.resume_session(options[:continue])
|
|
76
|
-
unless res[:ok]
|
|
77
|
-
warn "[Rubik] Warning: #{res[:error]}"
|
|
78
|
-
end
|
|
83
|
+
warn "[Rubik] Warning: #{res[:error]}" unless res[:ok]
|
|
79
84
|
end
|
|
80
85
|
|
|
81
86
|
if options[:script]
|
data/lib/rubik/adapter/base.rb
CHANGED
|
@@ -5,6 +5,7 @@ require_relative "process"
|
|
|
5
5
|
require_relative "../platform"
|
|
6
6
|
require_relative "../runtime/discovery"
|
|
7
7
|
require_relative "../runtime/diagnostic_engine"
|
|
8
|
+
require_relative "../security/guard" unless defined?(Rubik::Security::Guard)
|
|
8
9
|
|
|
9
10
|
module Rubik
|
|
10
11
|
module Adapter
|
|
@@ -107,6 +108,7 @@ module Rubik
|
|
|
107
108
|
|
|
108
109
|
def resolve_test_cmd(root_dir = Dir.pwd, path: nil)
|
|
109
110
|
base = if @custom_test_cmd && !@custom_test_cmd.strip.empty?
|
|
111
|
+
validate_custom_command!(@custom_test_cmd)
|
|
110
112
|
@custom_test_cmd
|
|
111
113
|
else
|
|
112
114
|
discovered = if @config
|
|
@@ -135,6 +137,7 @@ module Rubik
|
|
|
135
137
|
|
|
136
138
|
def resolve_format_cmd(file_path)
|
|
137
139
|
if @custom_format_cmd && !@custom_format_cmd.strip.empty?
|
|
140
|
+
validate_custom_command!(@custom_format_cmd)
|
|
138
141
|
if @custom_format_cmd.include?("%s")
|
|
139
142
|
format(@custom_format_cmd, Shellwords.escape(file_path))
|
|
140
143
|
else
|
|
@@ -152,6 +155,22 @@ module Rubik
|
|
|
152
155
|
|
|
153
156
|
protected
|
|
154
157
|
|
|
158
|
+
# Validate a custom command string through the Security::Guard before it
|
|
159
|
+
# is ever interpolated into a shell string or executed. These commands
|
|
160
|
+
# are operator-supplied arbitrary shell commands; running them without
|
|
161
|
+
# classification is the exact RCE surface the adapters used to expose.
|
|
162
|
+
# Fail-closed: an unclassifiable or dangerous string raises
|
|
163
|
+
# BlockedWriteError rather than running. A subclass may pre-seed
|
|
164
|
+
# @validation_guard with the shared session guard (operator policy);
|
|
165
|
+
# the fresh fallback (silent audit, zero policy) serves standalone/test
|
|
166
|
+
# constructions only.
|
|
167
|
+
def validate_custom_command!(cmd_str, shell: nil)
|
|
168
|
+
return true if cmd_str.nil? || cmd_str.to_s.strip.empty?
|
|
169
|
+
|
|
170
|
+
(@validation_guard ||= Rubik::Security::Guard.new(audit_log_path: nil)).verify_command_safety!(cmd_str, shell: shell)
|
|
171
|
+
true
|
|
172
|
+
end
|
|
173
|
+
|
|
155
174
|
def default_test_cmd
|
|
156
175
|
nil
|
|
157
176
|
end
|
|
@@ -32,20 +32,6 @@ module Rubik
|
|
|
32
32
|
@custom_syntax_cmd = syntax_cmd
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# Validate a custom command string through the Security::Guard before it
|
|
36
|
-
# is ever executed. These commands are operator-supplied arbitrary shell
|
|
37
|
-
# commands; running them without classification is the exact RCE surface
|
|
38
|
-
# this adapter used to expose. Fail-closed: an unclassifiable or dangerous
|
|
39
|
-
# string raises BlockedWriteError rather than running. The injected
|
|
40
|
-
# session guard carries operator policy; the fresh fallback (silent
|
|
41
|
-
# audit, zero policy) serves standalone/test constructions only.
|
|
42
|
-
def validate_custom_command!(cmd_str, shell: nil)
|
|
43
|
-
return true if cmd_str.nil? || cmd_str.to_s.strip.empty?
|
|
44
|
-
|
|
45
|
-
(@validation_guard ||= Rubik::Security::Guard.new(audit_log_path: nil)).verify_command_safety!(cmd_str, shell: shell)
|
|
46
|
-
true
|
|
47
|
-
end
|
|
48
|
-
|
|
49
35
|
def available?
|
|
50
36
|
Runtime::Discovery.binary_available?(@binary_name)
|
|
51
37
|
end
|
data/lib/rubik/adapter/node.rb
CHANGED
|
@@ -19,6 +19,7 @@ module Rubik
|
|
|
19
19
|
|
|
20
20
|
def resolve_test_cmd(root_dir = Dir.pwd, path: nil)
|
|
21
21
|
base = if @custom_test_cmd && !@custom_test_cmd.strip.empty?
|
|
22
|
+
validate_custom_command!(@custom_test_cmd)
|
|
22
23
|
@custom_test_cmd
|
|
23
24
|
else
|
|
24
25
|
base_node_test_cmd(root_dir)
|
|
@@ -99,6 +100,7 @@ module Rubik
|
|
|
99
100
|
|
|
100
101
|
def resolve_format_cmd(file_path)
|
|
101
102
|
if @custom_format_cmd && !@custom_format_cmd.strip.empty?
|
|
103
|
+
validate_custom_command!(@custom_format_cmd)
|
|
102
104
|
if @custom_format_cmd.include?("%s")
|
|
103
105
|
format(@custom_format_cmd, Shellwords.escape(file_path))
|
|
104
106
|
else
|
|
@@ -6,9 +6,22 @@ module Rubik
|
|
|
6
6
|
module AST
|
|
7
7
|
module TreeSitter
|
|
8
8
|
class ZigWalker < BaseWalker
|
|
9
|
-
|
|
9
|
+
# Zig grammar node kinds vary by grammar version: the pre-1.25
|
|
10
|
+
# tree_sitter_language_pack grammar used Decl/FnProto/ProtoDecl/
|
|
11
|
+
# FunctionDecl/function_definition; 1.25+ (official tree-sitter-zig)
|
|
12
|
+
# uses function_declaration. Keep every known spelling so the walker
|
|
13
|
+
# works across the supported pack range.
|
|
14
|
+
FN_KINDS = ["FnProto", "ProtoDecl", "FunctionDecl", "function_definition",
|
|
15
|
+
"function_declaration"].freeze
|
|
10
16
|
private_constant :FN_KINDS
|
|
11
17
|
|
|
18
|
+
# Top-level declaration kinds per grammar version: pre-1.25 exposed a
|
|
19
|
+
# single "Decl" node; 1.25+ splits into variable_declaration and
|
|
20
|
+
# function_declaration (struct/enum containers are regex-matched in
|
|
21
|
+
# walk_decl off the variable_declaration text).
|
|
22
|
+
DECL_KINDS = ["Decl", "variable_declaration", "function_declaration"].freeze
|
|
23
|
+
private_constant :DECL_KINDS
|
|
24
|
+
|
|
12
25
|
def walk(root_node)
|
|
13
26
|
symbols = []
|
|
14
27
|
return symbols unless root_node
|
|
@@ -59,7 +72,7 @@ module Rubik
|
|
|
59
72
|
(0...node.named_child_count).each do |i|
|
|
60
73
|
child = node.named_child(i)
|
|
61
74
|
case child.kind
|
|
62
|
-
when
|
|
75
|
+
when *DECL_KINDS
|
|
63
76
|
walk_decl(child, symbols)
|
|
64
77
|
else
|
|
65
78
|
walk_children(child, symbols, depth: depth + 1)
|
|
@@ -25,6 +25,10 @@ module Rubik
|
|
|
25
25
|
Rubik can read and modify workspace files and run foreground and background commands.
|
|
26
26
|
Some commands may run without a separate approval. OS sandboxing is disabled by default.
|
|
27
27
|
|
|
28
|
+
MCP stdio servers spawned here inherit this environment (minus bundler/Ruby runtime
|
|
29
|
+
variables), including credential-shaped variables, unless a server configures
|
|
30
|
+
`inherit_env: false`. Treat each server's env block as a credential-flow decision.
|
|
31
|
+
|
|
28
32
|
`buffer.model_can_apply: false` only restricts applying staged buffer changes; it does
|
|
29
33
|
not restrict shell commands.
|
|
30
34
|
NOTICE
|
|
@@ -46,6 +50,7 @@ module Rubik
|
|
|
46
50
|
end
|
|
47
51
|
|
|
48
52
|
def trusted?(workspace, store_path: default_store_path)
|
|
53
|
+
return true if ENV["RUBIK_TRUST_WORKSPACE"] == "1" && store_path == default_store_path
|
|
49
54
|
return false unless File.file?(store_path)
|
|
50
55
|
|
|
51
56
|
store = YAML::Store.new(store_path, true)
|
|
@@ -59,6 +64,7 @@ module Rubik
|
|
|
59
64
|
def trust!(workspace, store_path: default_store_path)
|
|
60
65
|
FileUtils.mkdir_p(File.dirname(store_path), mode: 0o700)
|
|
61
66
|
workspace_path = File.realpath(workspace)
|
|
67
|
+
ensure_owner_only_store!(store_path)
|
|
62
68
|
store = YAML::Store.new(store_path, true)
|
|
63
69
|
store.transaction do
|
|
64
70
|
paths = Array(store[TRUSTED_WORKSPACES_KEY])
|
|
@@ -69,6 +75,17 @@ module Rubik
|
|
|
69
75
|
|
|
70
76
|
private
|
|
71
77
|
|
|
78
|
+
# YAML::Store creates a missing file with the process umask
|
|
79
|
+
# (typically 0644); the trust store must be owner-only from the first
|
|
80
|
+
# byte on disk, so it is pre-created at 0600 before the transaction
|
|
81
|
+
# opens it. Failure keeps the legacy best-effort chmod behavior.
|
|
82
|
+
def ensure_owner_only_store!(path)
|
|
83
|
+
FileUtils.touch(path) unless File.exist?(path)
|
|
84
|
+
File.chmod(0o600, path)
|
|
85
|
+
rescue SystemCallError
|
|
86
|
+
nil
|
|
87
|
+
end
|
|
88
|
+
|
|
72
89
|
def default_store_path
|
|
73
90
|
File.join(Platform.home_dir, ".rubik", "trusted_workspaces.yml")
|
|
74
91
|
end
|