You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(policy): starter pack + CI exit codes; advertise on the site
Three new starter policies make Lane H actually adoptable instead of
just possible. Together with the existing no-huge-files.rfl they
cover the four most common review patterns teams want a CI gate on:
- concentrated-ownership.rfl bus_factor == 1 on >= 5 commits
- change-hotspot.rfl temporal_hotspots.risk_score > 200
- tightly-coupled-pairs.rfl coupling_strength_milli > 500 and
co_commits >= 3 (info-severity)
Each runs end-to-end against raysense's own self-baseline today;
agents and CI both get back deterministic, code-reviewable rules.
CI exit codes turn `raysense policy check` from a reporting tool into
a gate. The shared helper `memory::policy_exit_code` returns 0 for
clean runs, 1 when any policy itself fails to evaluate (parse / type
/ schema error -- "I cannot tell whether the rule passed"), 2 when
every policy parsed but at least one reported an error-severity
finding. Eval errors outrank findings because a misconfigured policy
is more dangerous than a known violation. Both the CLI and the MCP
tool surface the code; MCP also keeps a `pass: bool` for ergonomics.
The mutex in src/memory.rs#tests is the cost of having a process-
singleton rayforce runtime: ray_sym_load clobbers the global sym
table on every read, ray_env_set rebinds 18 names per policy run,
and Cargo runs tests across multiple threads. RAYFORCE_TEST_LOCK
serializes the affected tests; the few that only build a RayMemory
in memory and never read back from disk also take the guard for
safety since ray_sym_intern shares state with the loader path.
Without this the new tests flaked at 4 of 151 fail under contention.
With it: 151/151 stable across repeated runs (~11s wall clock).
Site update: a new "Query + Policy" section on sense.rayforcedb.com
positions the Rayfall + policy-packs surface as the headline
differentiator -- "architectural rules as code, not config." The
agent-integration block bumps from four to five skills (the new
raysense-query); the capabilities band shifts to alt-bg to keep the
visual rhythm. llms.txt mirrors the same content for crawlers.
Raysense ships as a Claude Code plugin and as a stdio MCP server compatible with any client that speaks the Model Context Protocol. Install the plugin and the agent gets four phase-scoped skills it can pick up at the right moments in its edit cycle. Project state lives in <code><repo>/.raysense/</code>, never in a global registry, so two sessions on two repositories stay strictly independent.
236
+
Raysense ships as a Claude Code plugin and as a stdio MCP server compatible with any client that speaks the Model Context Protocol. Install the plugin and the agent gets five skills covering the edit loop: scan and baseline at session start, blast radius before edits, regression diff after, audits on demand, and a Rayfall query skill for any question the typed tools do not already answer. Project state lives in <code><repo>/.raysense/</code>, never in a global registry, so two sessions on two repositories stay strictly independent.
237
237
</p>
238
238
239
239
<divclass="code-block code-block-wide">
@@ -263,11 +263,57 @@ <h3>Verify</h3>
263
263
<h3>Audit</h3>
264
264
<p>On request. Architecture, DSM, evolution, test gaps.</p>
265
265
</div>
266
+
<divclass="phase-card">
267
+
<divclass="phase-step">5</div>
268
+
<h3>Query</h3>
269
+
<p>Anytime. Custom Rayfall slices over the saved baseline.</p>
270
+
</div>
271
+
</div>
272
+
</div>
273
+
</section>
274
+
275
+
<sectionid="query" class="section">
276
+
<divclass="container">
277
+
<divclass="section-eyebrow">QUERY + POLICY</div>
278
+
<h2>Architectural rules as code, not config.</h2>
279
+
<pclass="section-lead">
280
+
Every saved baseline is a queryable columnar database. Agents and humans run Rayfall expressions over the call graph, the import graph, ownership history, and change coupling - select queries for filters and aggregates, <code>.graph.*</code> algorithms for centrality and reachability (PageRank, Louvain, topsort, shortest-path, betweenness), Datalog rules with transitive closure for declarative reachability. Drop the same expression into a <code>.rfl</code> file under <code>.raysense/policies/</code> and it becomes a CI gate. No vendored YAML schema, no plugin SDK to learn - rules ship as code-reviewable files alongside the codebase they govern.
<pre><code><spanclass="hl-cmt">;; Files over 2000 lines block the merge.</span>
286
+
<spanclass="hl-cmt">;; Result table columns: severity, code, path, message.</span>
287
+
(select {severity: "error"
288
+
code: "huge-file"
289
+
path: path
290
+
message: "file exceeds 2000 lines, split before merging"
291
+
from: files
292
+
where: (> lines 2000)})</code></pre>
293
+
</div>
294
+
295
+
<divclass="feature-grid">
296
+
<divclass="feature-card">
297
+
<h3>Ad-hoc Rayfall queries</h3>
298
+
<p>Agents call <code>raysense_baseline_query</code> with a Rayfall expression. The named baseline table is bound as <code>t</code> and the result returns as JSON. Three modes: select for filter/project/aggregate, <code>.graph.*</code> for centrality and shortest-path, Datalog for transitive reachability that mirrors blast-radius in two lines.</p>
299
+
</div>
300
+
<divclass="feature-card">
301
+
<h3>Pinned policies</h3>
302
+
<p><code>raysense policy check</code> walks <code>.raysense/policies/*.rfl</code>, evaluates each, returns findings in the same envelope as built-in rules. Exit code 0 for pass, 1 for any policy that failed to evaluate, 2 for any error-severity finding. Wire it into a pre-commit hook or a CI gate without touching raysense's release cadence.</p>
303
+
</div>
304
+
<divclass="feature-card">
305
+
<h3>One vocabulary, two surfaces</h3>
306
+
<p>An <code>.rfl</code> policy and an interactive query reference the same baseline tables - <code>files</code>, <code>module_edges</code>, <code>change_coupling</code>, <code>file_ownership</code>, <code>call_edges</code> - because there is only one substrate. Promote a one-off query into a committed rule by renaming the file.</p>
307
+
</div>
308
+
<divclass="feature-card">
309
+
<h3>Composable across history</h3>
310
+
<p>The baseline already carries change-coupling, file-ages, ownership, and rule-violation tables alongside the structural ones. Cross-time queries like "files tightly coupled in the last 60 days that sit on cycles and changed without test edits" stay one Rayfall expression, not three tools.</p>
Copy file name to clipboardExpand all lines: site/llms.txt
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -38,15 +38,25 @@ raysense --mcp # stdio MCP server for agents
38
38
39
39
## Agent integration
40
40
41
-
Raysense ships as a Claude Code plugin. The plugin gives the agent four phase-scoped skills:
41
+
Raysense ships as a Claude Code plugin. The plugin gives the agent five skills covering the edit loop:
42
42
43
43
1. Bootstrap. At session start: scan, save baseline, materialise scan results as splayed-table memory.
44
44
2. Impact. Before non-trivial edits: blast radius, coupling, cycle exposure.
45
45
3. Verify. After edits: rescan, rule check, baseline diff.
46
46
4. Audit. On request: architecture, DSM, evolution signals, test gaps.
47
+
5. Query. Anytime: ad-hoc Rayfall expressions over the saved baseline (filter, project, aggregate, graph algorithms, Datalog rules with transitive closure).
47
48
48
49
Project state lives in `<repo>/.raysense/`, never in a global registry. Two concurrent sessions on two different repos are strictly independent.
49
50
51
+
## Query and policy
52
+
53
+
Every saved baseline is a queryable columnar database. Two surfaces share one substrate:
54
+
55
+
- Ad-hoc query: `raysense_baseline_query` (MCP) or `raysense baseline query <table> <expr>` (CLI). Three modes - select queries for filter/project/aggregate, `.graph.*` algorithms (PageRank, Louvain, topsort, shortest-path, betweenness, closeness, k-shortest, MST, BFS/DFS expand) for centrality and reachability, Datalog rules with transitive closure for declarative reachability.
56
+
- Pinned policy: drop a `.rfl` file in `<repo>/.raysense/policies/` and `raysense policy check` (or the `raysense_policy_check` MCP tool) walks the directory, evaluates each policy, and reports findings using the same RuleFinding envelope as built-in rules. Exit code 0 for pass, 1 if any policy failed to evaluate, 2 if any error-severity finding. Architectural rules ship as code-reviewable files alongside the codebase they govern - no vendored YAML schema, no plugin SDK to learn.
57
+
58
+
A policy is just a Rayfall expression that returns a table with columns severity, code, path, message. Empty result table = policy passed.
59
+
50
60
## Capabilities beyond the score
51
61
52
62
- Live treemap dashboard. Every file, every metric, every cycle, refreshed on save.
0 commit comments