Commit Graph

73 Commits

Author SHA1 Message Date
Adrien Eppling 9bc4323916 Merge origin/develop into clean/awareness-file
Resolved: awareness constants vs Pi/OMP rework, InitContext destructures,
bun/deno CLI additions, write_if_changed split.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVD4ZD5wiSjSsNpKCK6h7q
2026-09-07 11:06:29 +02:00
Adrien Eppling 4bbf778897 fix(init): address review — local init honours awareness level, cleanup
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVD4ZD5wiSjSsNpKCK6h7q
2026-09-07 10:48:55 +02:00
alvins82 d302797c51 fix(hooks)!: harden aliased Pi and OMP extension lifecycle
Treat pre-existing extensions without ownership state as uncertain, cover project-scope aliases, clean canonical sidecars after symlink removal, and classify protected extension overwrites as breaking.

BREAKING CHANGE: non-interactive installs of modified or unrelated Pi/OMP extensions now require --auto-patch to approve overwrites.
2026-09-03 11:04:19 +12:00
alvins82 ba6a1f57a3 fix: harden shared extension ownership handling 2026-09-03 09:35:36 +12:00
alvins82 8c25ada388 fix: harden shared extension ownership 2026-08-29 13:22:28 +12:00
alvins82 42a91474e9 fix: track shared agent ownership safely 2026-08-29 11:29:50 +12:00
alvins82 48ee59ec1b fix: address latest OMP review feedback 2026-08-29 09:08:48 +12:00
alvins82 256d4a77bb fix: handle extension safety review feedback 2026-08-28 13:53:15 +12:00
alvins82 002248839e fix: address second OMP review feedback 2026-08-28 13:07:56 +12:00
alvins82 d268e8f282 fix: address follow-up review feedback 2026-08-28 12:11:51 +12:00
alvins82 12a7cf0946 Merge remote-tracking branch 'origin/develop' into omp-shared
# Conflicts:
#	hooks/README.md
2026-08-27 12:45:46 +12:00
alvins82 ad51059674 fix: address OMP integration review feedback 2026-08-27 12:36:38 +12:00
Nicolas Le Cam 322db4da98 Merge pull request #2938 from raj921/fix/pi-slow-startup
perf(hook): avoid Pi package barrel import
2026-08-27 01:29:58 +02:00
Nicolas Le Cam fb61481a76 address review comments: explain type-guard rationale and link #2753
Also fixes two docs left stale by the barrel-import removal: hooks/pi/README.md
and hooks/README.md still described bash-tool detection via the removed
isToolCallEventType value import.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-27 01:14:46 +02:00
alvins82 4c72946868 feat(pi): shared extension gains guarded OMP status/label hooks
The extension is shared with OMP via its legacy-pi-compat layer. Add
guarded helpers that are strict no-ops on Pi: a persistent
"RTK disabled: <reason>" session status registered on session_start
(OMP wipes one-shot notify toasts on the initial render) and a
setLabel("RTK") UI label set before the version probe, so the
extension is identifiable in the session UI even when rtk is missing
or too old.

Co-authored-by: makoMakoGo <makoMakoGo@users.noreply.github.com>
2026-08-25 19:04:07 +12:00
alvins82 1664772215 feat(omp): add Oh My Pi (OMP) support
Add `--agent omp` to `rtk init` (with `-g`, `--uninstall`, `--show`)
for the Oh My Pi coding agent (https://github.com/can1357/oh-my-pi).

OMP loads the same `hooks/pi/rtk.ts` extension via its built-in
legacy-pi-compat layer, which remaps the Pi package imports to OMP's
bundled equivalent — so no separate OMP implementation is needed and
the rewrite behavior stays byte-identical (mutualization).

- Local scope: <project>/.omp/extensions/rtk.ts
- Global scope: ~/.omp/agent/extensions/rtk.ts
- `--uninstall` is three-way safe: missing → no-op, stock content →
  removed, modified RTK content → bail with manual-removal guidance
- `--show` reports both scopes (installed / stock / modified / absent)

Co-authored-by: makoMakoGo <makoMakoGo@users.noreply.github.com>
2026-08-25 19:04:07 +12:00
Adrien Eppling aefea91a21 feat(init): add awareness.level config with default/high/full instruction files 2026-08-20 10:10:26 +02:00
Adrien Eppling c6f83aeb51 chore(hooks): move awareness file out of claude folder (agent-neutral) 2026-08-19 14:41:31 +02:00
Adrien Eppling d667f21801 chore(hooks): precise proxy trigger and batching hint in awareness text 2026-08-19 14:40:01 +02:00
Adrien EPPLING 6c441a7162 chore(hooks): neutral, command-free Claude awareness file
Replace the RTK reference (meta commands, rtk proxy bypass, install
verification, branding, hook framing) with a minimal note stating that
condensed output is complete/authoritative and commands should be run
normally. Removes the runnable command blocks and bypass hint that led
agents to run extra commands and re-verify. Claude only.
2026-08-19 14:10:20 +02:00
Xavier Pestel 94ae76b2da docs(vibe): add hooks/vibe/README.md and link from Directory Structure
Every other agent with a dedicated hook implementation carries a
hooks/<agent>/README.md (see antigravity/cline/opencode/copilot/hermes
for the shape). The initial Vibe commit skipped this, leaving Vibe as
the odd one out in the hooks/ layout.

- Add hooks/vibe/README.md following the Copilot template (Rust binary
  hook, no shell dependency). Documents the pre_tool hook location,
  input JSON shape, rewrite response, passthrough / deny behavior,
  and the belt-and-suspenders prompt fallback.
- Fix hooks/README.md Directory Structure entry to point at
  vibe/README.md (previously claimed 'no dedicated subdirectory').
2026-08-05 15:37:02 +02:00
Xavier Pestel 1847b07f7a fix(vibe): address PR review — exit code contract, tests, telemetry, docs
Addresses @aeppling's review on #3391:

Blocking fixes:
- run_vibe now returns Ok(()) on malformed JSON (matches run_droid /
  run_copilot / run_cursor pattern). Prior code violated the exit-code
  contract documented at src/hooks/README.md:100 — a bad payload exited
  non-zero and blocked the agent's command. Fixed via a match on
  serde_json::from_str with a stderr warning fallback.
- Extract run_vibe_inner(input: &str) -> Option<String> from run_vibe so
  the hook contract is unit-testable (mirrors run_droid_inner). Public
  run_vibe becomes a thin stdin/stdout wrapper.
- Add 6 runtime tests exercising the hook contract: bash rewrite happy
  path, non-bash tool passthrough, empty command passthrough, malformed
  JSON returns None, unknown binary passthrough, substitution defers.

Should-fix:
- Telemetry agent detection: add ~/.vibe/hooks.toml to detect_hook_type()
  checks in src/core/telemetry.rs, plus the two test enum arrays so Vibe
  sessions no longer report as 'unknown' in rtk gain history.
- Dead deny arm: add a comment on Host::Vibe in permissions.rs
  documenting that the empty-rules branch is defensive scaffolding for
  when Vibe ships native denylist/allowlist config we can honor.
- Broken link: patch_vibe_hooks_toml skip-message now points at
  https://www.rtk-ai.app/guide/getting-started/supported-agents#mistral-vibe
  instead of a fragment that doesn't resolve.

Nits addressed:
- Install summary no longer prints 'hook installed' when the user chose
  PatchMode::Skip or declined the interactive prompt. patch_vibe_hooks_toml
  now returns a VibeHookPatchOutcome enum (Installed / AlreadyPresent /
  Skipped) and the caller gates the summary on it.
- Document the string-spacing tradeoff on vibe_hooks_toml_has_rtk: a
  reformatted 'name="rtk-rewrite"' would defeat idempotency, acceptable
  because we control the writer and toml_edit round-trip would clobber
  user comments.
- Fix stale line in src/hooks/README.md 'Adding New Functionality':
  hook_check.rs::maybe_warn() only checks the Claude Code hook now,
  not every agent.

Documentation:
- docs/guide/getting-started/supported-agents.md: frontmatter now lists
  Mistral Vibe, drop 'planned' from the intro, tier table row flipped
  from 'Planned (#800)' to 'Rust binary (pre_tool) / Yes', replace the
  ### Mistral Vibe (planned) placeholder with a full user-facing section
  modeled on Factory Droid (install/uninstall commands, hook mechanism,
  permission semantics, idempotency contract).
- hooks/README.md: agent count 9 -> 10, add Vibe entry to Directory
  Structure list, add Vibe row to Supported Agents table, add
  '### Mistral Vibe (Rust Binary)' entry to the JSON Formats section
  showing the pre_tool input shape and rewrite response shape.
- src/hooks/README.md: agent count 5 -> 6, add Vibe row to per-host
  ask-support table.
- README.md: '15 AI coding tools' -> '16'.

No behavior change for existing agents.
2026-08-05 13:55:09 +02:00
Takayuki Maeda ca418939c3 Merge pull request #3128 from TaKO8Ki/fix/pipe-rewrite-safety 2026-07-23 23:33:15 +09:00
Adrien Eppling a1673f7428 docs: scope savings claims to bash output and document the estimator
RTK was documented as delivering "60-90% token savings", which reads as a
cost reduction. What RTK actually reduces is bash output bytes. Those are
one contributor to input tokens, which are themselves only part of a bill
that also counts output tokens, so the reduction dilutes at every step.

- add docs/guide/resources/savings-explained.md as the canonical explainer:
  the savings chain, both estimators, and what RTK does not reduce
- rescope the headline claim across README (7 languages), the guide, hook
  rules, agent definitions and module READMEs
- relabel per-command tables as bash output reduction, keeping every figure
- document that reported tokens are estimates: rtk gain uses bytes/4
  (src/core/tracking.rs), filter tests use split_whitespace().count().
  Neither is a real tokenizer, so ratios hold but absolute counts do not

Remove figures that had no source: the $3/Mtok constant and its $36
example, the +/-10% tokenization accuracy claim, the 99.5% hook-install
figure, the invented session tables in README and INSTALL, and the 30-50%
parser range.

CHANGELOG is untouched. Shipped release notes stay as a historical record.
2026-07-22 18:33:54 +02:00
Takayuki Maeda 297d664f24 docs: explain safe pipeline rewriting 2026-07-22 04:44:47 +09:00
raj921 3e7d02d7b4 perf(hook): avoid Pi package barrel import 2026-07-11 01:05:51 +05:30
Nicolas Le Cam bd10b002d0 Follow up on #2609:
- Fix documentation, Cursor now uses native rust binary hook
- Fix rtk-rewrite.sh shell script to fail on any exit code except 0 and 3
- Test that "continue": true is also present for "permission": "ask" and sync shell rewrite hook
2026-06-30 22:18:39 +02:00
Guy Oron a0c16ef0bc fix(hook): use ask permission for AskRewrite in Cursor hook
Address PR #2609 review feedback:
- RC=3 in shell script now emits "permission": "ask" (future-proof)
- Add cursor_ask() and use it for all AskRewrite decisions
- Remove has_rules guard (unnecessary with ask semantics)
- Remove dead cursor_has_explicit_rules() function
2026-06-29 14:18:05 +02:00
guy oron ff0b9ac28c fix(hook): handle AskRewrite in Cursor hook when no rules configured
When no explicit permission rules exist in ~/.cursor/cli-config.json
(the default for fresh installs), every command gets Default verdict
which maps to AskRewrite. The Cursor hook only handled AllowRewrite,
silently dropping all rewrites and making RTK non-functional.

Now treat AskRewrite as allow when no rules are configured — Cursor
has no ask-the-user UX, so deferring is indistinguishable from
dropping. When explicit rules exist, preserve the conservative
behavior of deferring mixed/unmatched commands.

Also fix the legacy shell script (rtk-rewrite.sh) which treated
exit code 3 (ask) as failure via || short-circuit.

Fixes #2372
2026-06-29 14:18:05 +02:00
Nicolas Le Cam c59a76375a review: cleanup code, comments and uneeded undocumented RTK_CLAUDE_DIR now that we have CLAUDE_CONFIG_DIR 2026-06-09 21:51:23 +02:00
gitbluf f6a54518bd chore: minor cleanup 2026-05-23 01:58:47 +02:00
gitbluf 8bc8b46384 chore: sync with pi api 2026-05-23 01:57:37 +02:00
gitbluf 9bd6e6f392 feat: address pr suggestions 2026-05-23 01:36:07 +02:00
gitbluf cb1661e68d feat(init): remove --pi flag, canonicalize Pi install to --agent pi
chore: sync the codebase after mergew
2026-05-11 21:46:46 +02:00
Marko Petrovic 1ef5b10f73 Merge branch 'develop' into develop 2026-05-11 20:17:22 +02:00
Kayphoon 9d3b99dec8 feat(hermes): add rtk integration
Signed-off-by: Kayphoon <109347466+Kayphoon@users.noreply.github.com>
2026-05-12 00:30:39 +08:00
Marko Petrovic a7cab79084 chore: update hooks/pi/rtk.ts to reflect new package name
Co-authored-by: Jean du Plessis <jeandp@gmail.com>
2026-05-08 00:32:31 +02:00
gitbluf b2a3ad9443 feat: rm rtk awareness injection 2026-05-06 18:44:27 +02:00
gitbluf d6e27527ea refactor: handling of uninstallation 2026-05-06 16:38:01 +02:00
gitbluf 1da5793b92 feat(hooks): add Pi coding agent integration 2026-05-06 15:43:04 +02:00
aesoft 2e401ac38f fix(docs): add missing docs for exclude commands patterns 2026-04-19 13:59:03 +02:00
aesoft 9e96caa0a1 Merge pull request #355 from KuSh/pnpx+dlx
feat(discover): handle more npm/npx/pnpm/pnpx patterns
2026-04-13 20:31:12 +02:00
Florian BRUNIAUX fadd46b6e4 Merge pull request #970 from zerone0x/fix/issue-968-hook-spawn-eagain 2026-04-13 09:25:48 +02:00
Nicolas Le Cam 45938b2a4d feat(js): distinguish between jest and vitest and don't rewrite npm test commands as we don't know which test framework is used under the hood
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
2026-04-12 22:03:39 +02:00
michaelschleiss d442799e34 fix(init): honor CODEX_HOME for Codex global paths 2026-04-09 10:32:43 +02:00
yosoyepa d0a3797ec5 feat(init): add native support for Kilo Code and Google Antigravity
Add rtk init --agent kilocode and rtk init --agent antigravity commands.

Kilo Code: installs .kilocode/rules/rtk-rules.md (project-scoped)
Google Antigravity: installs .agents/rules/antigravity-rtk-rules.md (project-scoped)

Both follow the same prompt-level guidance pattern as Cline and Windsurf,
using rules files that instruct the agent to prefix shell commands with rtk.
2026-04-08 15:37:29 -05:00
zerone0x 74a1fd2765 fix(hooks): reduce jq invocations in rtk-rewrite\n\nFixes #968 2026-04-02 12:59:46 +02:00
zerone0x b3a7e753fe fix(hook): reduce rewrite hook spawn overhead
Fixes #968

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-02 12:59:37 +02:00
sveitser bec18c40a2 fix: use /usr/bin/env shebangs for portability across systems 2026-03-26 19:46:28 +01:00
aesoft 967d2bfcf9 Merge branch 'develop' of https://github.com/rtk-ai/rtk into refacto-folders-and-documentation 2026-03-25 19:55:42 +01:00