Skip to content

feat: v0.4.0 — observability for organic lens growth#3

Merged
broomva merged 1 commit into
mainfrom
feat/v0.4.0-observability
May 14, 2026
Merged

feat: v0.4.0 — observability for organic lens growth#3
broomva merged 1 commit into
mainfrom
feat/v0.4.0-observability

Conversation

@broomva

@broomva broomva commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the half-loop from v0.3.0. Ships the data substrate that lets the `roles/` registry expand from real telemetry instead of speculative authoring.

Added

  • `role-x suggest` — analyze `events.jsonl` over a window; report fire-rate, per-lens drift, and (when sanitized capture is on) emergent keyword clusters in unrouted events with suggested lens names. Read-only.
  • `role-x init ` — scaffold a `status: candidate` lens under `roles/.md` from CLI flags. Generated file passes `validate` immediately.
  • Opt-in sanitized prompt capture — via `~/.config/broomva/role/config.json` (privacy-by-default off). Two strategies: `keywords` (top-N unique tokens) and `first_chars` (first N chars).
  • 10 new tests (20 → 30 total).
  • `references/observability.md` (NEW, 168 LOC) — full data substrate docs.

Verified against live data

```
$ role-x suggest --since 7d
[role-x suggest] window: --since 7d, events: 36
fired ≥1 lens: 5 (14%)
_meta only: 31 (86%)

Cluster discovery requires sanitized prompt capture (privacy-by-default off).
→ To enable, write:
/Users/broomva/.config/broomva/role/config.json
{"capture_sanitized_prompt": true, "sanitization_strategy": "keywords"}

Active lens drift summary:
rust-systems: 5 fires, 5 sessions, avg prompt 11 words
```

Real telemetry from the past week. 14% coverage rate suggests the registry needs Tier-1 expansion (`ts-nextjs`, `docs-research`, `security-review`, `bstack-governance`). v0.4.0 enables data-driven decisions on what to author.

Privacy invariant

Absent config = no sanitized capture. v0.1.0-v0.3.0 installations are byte-for-byte unaffected. `prompt_digest` (sha256) remains the only required-capture field. Sanitized capture is opt-in per-workstation via the config file.

Test plan

  • 30/30 pytest pass (Python 3.11 + 3.12 in CI)
  • Backward compat: existing 20 tests unchanged and green
  • Smoke against live events.jsonl: suggest reports correctly with no sanitized data
  • init scaffold passes role-x validate immediately
  • Sanitized capture off (no config) → events lack prompt_sanitized field
  • Sanitized capture on (config opts in) → events have prompt_sanitized.value with top-N keywords
  • Existing workspace lenses (`_meta`, `rust-systems`) unchanged

Roadmap

  • v0.5.0 — `role-x tune ` (per-lens drift diffs) + `role-x propose-lens ` (generate candidate from cluster)
  • v0.6.0 (M5) — `role-x-replay.py` full P13 dream cycle with auto-promote on rule-of-three
  • v0.7.0 — `PostToolUse` + `Stop` outcome hooks → quality signals per lens-use
  • v0.8.0 — Lens decay + auto-demotion

🤖 Generated with Claude Code

Closes the half-loop from v0.3.0. The substrate that lets the roles/
registry expand from real telemetry instead of speculative authoring.

Added:
- `role-x suggest [--since 7d --threshold N --limit M]` — analyze
  events.jsonl over a window; reports fire-rate (lens-fired vs
  _meta-only), per-lens drift (fires + sessions + avg prompt length),
  and (when sanitized capture is on) emergent keyword clusters in
  _meta-only events with suggested lens names. Read-only.
- `role-x init <name> [--keywords --paths --branch-patterns --threshold
  --extends --mode --force]` — scaffold a status: candidate lens under
  roles/<name>.md from CLI flags. Generated file passes validate
  immediately. Author promotes to status: active after ≥3 positive-
  outcome uses (P16).
- Opt-in sanitized prompt capture via ~/.config/broomva/role/config.json:
  - capture_sanitized_prompt: bool (default false)
  - sanitization_strategy: "keywords" | "first_chars"
  - sanitization_top_n_keywords: int (default 5)
  - sanitization_first_chars: int (default 80)
  When enabled, intake events get optional `prompt_sanitized: {strategy,
  value}` field. When absent, behavior is identical to v0.3.0 — only
  prompt_digest (sha256) is recorded.
- 10 new tests (20 → 30 total) covering suggest fire-rate, lens drift,
  cluster discovery, config hint, empty log, init success, invalid name
  rejection, overwrite refusal, sanitized capture on/off.
- references/observability.md (NEW, 168 LOC) — full data substrate
  documentation: event schema, sanitized strategies, privacy guarantees,
  operational notes, v0.5.0+ roadmap.

Privacy invariant: absent config = no sanitized capture. Existing
v0.1.0/v0.2.0/v0.3.0 installations are byte-for-byte unaffected. Sha256
prompt_digest remains the only required-capture field.

Verified against live events.jsonl (36 events, 14% lens-fired, 86%
_meta-only) — rust-systems lens drift summary shows 5 fires across 5
sessions averaging 11 words.

Roadmap reshuffle:
- v0.5.0 — role-x tune <lens> + role-x propose-lens <cluster> (PR diffs)
- v0.6.0 (M5) — role-x-replay.py full P13 dream cycle with auto-promote
- v0.7.0 — PostToolUse + Stop outcome hooks (quality signals)
- v0.8.0 — Lens decay + auto-demotion

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@broomva has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 44 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4e063fbd-165d-4ae4-9b5e-db703c647a5b

📥 Commits

Reviewing files that changed from the base of the PR and between 9d2b223 and 904176e.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • README.md
  • references/feedback-loop.md
  • references/observability.md
  • scripts/role-x.py
  • tests/test_role_x.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/v0.4.0-observability

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@broomva broomva merged commit 22c7f53 into main May 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant