-
Notifications
You must be signed in to change notification settings - Fork 16
feat: terse persona prompt, bash+ipython default tools, actionable compaction handoff #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
038fd8a
feat: terse coding-agent persona for the default system prompt
samsja ab5882c
feat: default to bash+ipython tools, edit skill on, actionable compac…
samsja c94f4fd
style: ruff format bash tool
samsja 09fa1ba
feat: bash and edit usable as both tools and REPL skills
samsja 4a3fda8
feat: kernel-isolation line replaces the project-env rule
samsja 9e774b5
fix: bash skill executes via bash -c, matching the bash tool
samsja f7c38c2
refactor: bash skill reuses the tool's guarded runner
samsja 48bc669
chore: drop bash output clipping — return raw output like other harne…
samsja bee7135
feat: RLM_TOOLING preset — dual (default) | tools | skills
samsja 9b607b0
merge: main (supervisor sessions, ACP snapshots, markdownlint; absorb…
samsja ad74344
fix: bash tool honors explicit allow_git; edit tool anchors relative …
samsja 41e2698
fix: propagate exec-timeout and git policy into the kernel env
samsja File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| """Native ``bash`` builtin tool. | ||
|
|
||
| Runs one shell command per call in a fresh subshell, like a plain bash agent. | ||
| Enabled by default alongside ipython; override the tool set with ``RLM_BUILTIN_TOOLS``. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| import subprocess | ||
| from typing import Any | ||
|
|
||
| from rlm.tools.base import ToolContext, ToolOutcome | ||
| from rlm.tools.git_block import find_blocked_command, refusal | ||
|
|
||
| BASH_SCHEMA = { | ||
| "type": "function", | ||
| "function": { | ||
| "name": "bash", | ||
| "description": "Run a shell command and return its output (stdout and stderr).", | ||
| "parameters": { | ||
| "type": "object", | ||
| "properties": { | ||
| "command": { | ||
| "type": "string", | ||
| "description": "The shell command to run.", | ||
| }, | ||
| }, | ||
| "required": ["command"], | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| EDIT_SCHEMA = { | ||
| "type": "function", | ||
| "function": { | ||
| "name": "edit", | ||
| "description": ( | ||
| "Replace a string in a file. old_str must occur exactly once in the file; " | ||
| "the file is rewritten with old_str replaced by new_str." | ||
| ), | ||
| "parameters": { | ||
| "type": "object", | ||
| "properties": { | ||
| "path": {"type": "string", "description": "Path of the file to edit."}, | ||
| "old_str": { | ||
| "type": "string", | ||
| "description": "Exact string to replace (must be unique).", | ||
| }, | ||
| "new_str": {"type": "string", "description": "Replacement string."}, | ||
| }, | ||
| "required": ["path", "old_str", "new_str"], | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| def run_bash( | ||
| command: str, | ||
| timeout: int, | ||
| cwd: str | None = None, | ||
| allow_git: bool | None = None, | ||
| ) -> str: | ||
| """Guarded ``bash -c`` execution shared by the bash tool and the bash skill.""" | ||
| if not isinstance(command, str) or not command.strip(): | ||
| return "Error: empty command" | ||
| blocked = find_blocked_command(command, allow_git=allow_git) | ||
| if blocked: | ||
| return refusal(blocked) | ||
| try: | ||
| proc = subprocess.run( | ||
| ["bash", "-c", command], | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=timeout, | ||
| cwd=cwd or None, | ||
| ) | ||
| except subprocess.TimeoutExpired: | ||
| return f"Error: command timed out after {timeout}s" | ||
| out = proc.stdout + (("\n" + proc.stderr) if proc.stderr else "") | ||
| if proc.returncode != 0: | ||
| out += f"\n[exit code {proc.returncode}]" | ||
| return out.strip() or "(no output)" | ||
|
|
||
|
|
||
| class BashTool: | ||
| """One shell command per call, fresh subshell, cwd-anchored.""" | ||
|
|
||
| name = "bash" | ||
|
|
||
| def schema(self) -> dict[str, Any]: | ||
| return BASH_SCHEMA | ||
|
|
||
| def execute(self, args: dict[str, Any], context: ToolContext) -> ToolOutcome: | ||
| return ToolOutcome( | ||
| content=run_bash( | ||
| args.get("command", ""), | ||
| context.exec_timeout, | ||
| cwd=context.cwd, | ||
| allow_git=context.allow_git, | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| class EditTool: | ||
| """Single-occurrence string replacement, mirroring the edit skill semantics.""" | ||
|
|
||
| name = "edit" | ||
|
|
||
| def schema(self) -> dict[str, Any]: | ||
| return EDIT_SCHEMA | ||
|
|
||
| def execute(self, args: dict[str, Any], context: ToolContext) -> ToolOutcome: | ||
| path, old, new = args.get("path"), args.get("old_str"), args.get("new_str") | ||
| if not path or old is None or new is None: | ||
| return ToolOutcome(content="Error: path, old_str and new_str are required") | ||
| if context.cwd and not os.path.isabs(path): | ||
| path = os.path.join(context.cwd, path) | ||
| try: | ||
| text = open(path, encoding="utf-8").read() | ||
| except OSError as e: | ||
| return ToolOutcome(content=f"Error: cannot read {path}: {e}") | ||
| count = text.count(old) | ||
| if count == 0: | ||
| return ToolOutcome(content=f"Error: old_str not found in {path}") | ||
| if count > 1: | ||
| return ToolOutcome( | ||
| content=f"Error: old_str occurs {count} times in {path}; must be unique" | ||
| ) | ||
| open(path, "w", encoding="utf-8").write(text.replace(old, new, 1)) | ||
| return ToolOutcome(content=f"Edited {path} (1 replacement).") | ||
|
cursor[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.