Skip to content

fix(awareness): slim awareness text - #3372

Merged
KuSh merged 9 commits into
developfrom
clean/awareness-file
Sep 7, 2026
Merged

KuSh merged 9 commits into
developfrom
clean/awareness-file

Conversation

@aeppling

@aeppling aeppling commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

@CLAassistant

CLAassistant commented Aug 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seem to have accidentally included the commit from #3343

Comment thread hooks/claude/rtk-awareness.md Outdated
Comment thread hooks/claude/rtk-awareness.md
Comment thread hooks/claude/rtk-awareness.md
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.
@aeppling
aeppling force-pushed the clean/awareness-file branch 2 times, most recently from 0d256df to 6c441a7 Compare August 19, 2026 12:15
@aeppling aeppling changed the title Clean/awareness file fix(awareness): slim awareness text Aug 19, 2026
@aeppling

Copy link
Copy Markdown
Contributor Author

@KuSh

Thanks for review, it was intentionally stacked on top of #3343 for benchmarking purpose.
Now cleaned.

@aeppling
aeppling marked this pull request as ready for review August 19, 2026 12:42

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aeppling

Copy link
Copy Markdown
Contributor Author

@KuSh updated with awareness level configuration (agent without hooks are given the full instructions, else it is default / slim, user can still configure with toml)

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for some nitpicks

Comment thread src/hooks/init.rs Outdated
Comment thread src/hooks/init.rs Outdated
Comment thread src/hooks/init.rs
Comment thread src/main.rs Outdated
Comment thread src/hooks/init.rs Outdated

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three-level model is the right shape, and routing rules-only agents (Codex, Cline, Windsurf, Kilo Code, Antigravity, Kimi) unconditionally to full with print_rules_only_awareness_note is the correct call — those agents genuinely have to type rtk themselves.

One path is left behind, though: rtk init without -g never reaches awareness_content.

run_default_mode early-returns for local init (src/hooks/init.rs:1196-1201):

if !global {
    // Local init: inject CLAUDE.md + generate project-local filters template
    run_claude_md_mode(false, install_opencode, ctx)?;
    generate_project_filters_template(ctx)?;
    return Ok(());
}

and run_claude_md_mode still writes the legacy constant (src/hooks/init.rs:1656-1662):

let action = write_rtk_block(
    &path,
    RTK_INSTRUCTIONS,
    "rtk instructions",
    recovery_cmd,
    ctx,
)?;

RTK_INSTRUCTIONS (src/hooks/init.rs:157) is still the v2 block with:

## Golden Rule

**Always prefix commands with `rtk`**. If RTK has a dedicated filter, it uses it. If not, it passes through unchanged.

**Important**: Even in command chains with `&&`, use `rtk`:
...
rtk git add . && rtk git commit -m "msg" && rtk git push

So on a Claude Code install that does have the transparent rewrite hook, a project-local rtk init writes prefix-everything guidance into ./CLAUDE.md and awareness.level has no effect on it. --claude-md opting into that is intentional and fine; plain rtk init inheriting it is the part that looks unintended, since the PR's whole premise is that hook-based agents should default to being told nothing about RTK.

Practical consequence is the one #3186 describes: Claude reads the Golden Rule and types rtk git status itself. Claude Code matches permissions.allow against the literal command before the PreToolUse hook rewrites it, so the prefixed form misses the user's plain-command allow rules and prompts every time — while the unprefixed form would have been rewritten transparently anyway.

Two ways out, both small:

  1. Thread the level through — give run_claude_md_mode an explicit content argument and pass awareness_content(ctx.awareness) from the local branch, keeping RTK_INSTRUCTIONS only for the explicit --claude-md opt-in.
  2. Have local init follow the same shape as global: write the awareness file and add the @RTK.md reference, rather than inlining a block.

Worth noting the docs added here already imply (1): the configuration table says default means "Nothing about RTK", and "Re-run rtk init -g (or your agent's init command) to rewrite the file" reads as though every init path honours the setting.

Also minor: run_claude_md_mode's doc comment still says "full 137-line injection" — worth a look while the constant is in scope, since the block is now ~4KB and the test at src/hooks/init.rs:5424 asserts RTK_INSTRUCTIONS.len() > 4000.

@KuSh KuSh mentioned this pull request Sep 5, 2026
aeppling and others added 2 commits September 7, 2026 10:48
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
@KuSh

KuSh commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Following up on the local-init review from Aug 29: fixed in 4bbf778. run_default_mode's local branch now calls run_claude_md_mode_with(false, install_opencode, &rtk_block(awareness_content(ctx.awareness)), ctx) instead of the legacy RTK_INSTRUCTIONS Golden Rule block; RTK_INSTRUCTIONS is now only used by the explicit --claude-md opt-in. Covered by the new test_local_init_block_follows_awareness_level_not_legacy test, and verified against the built binary: plain rtk init now writes the slim awareness block to CLAUDE.md, while rtk init --claude-md still gets the full legacy block.

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.

3 participants