refactor(opencode): let @pm read TODO.md via git show, drop tempfile
Gives @pm narrowly-scoped bash access (git show *, git rev-parse *) so it can read TODO.md directly from any git ref. The workflow no longer needs to mktemp + redirect the file before invoking the agent; Phase 2 just tells @pm the bare repo path and default branch and lets it run git show "$DEFAULT_BRANCH:TODO.md" itself. Cleanup steps for the temp snapshot are removed from Phase 10 and the failure handler.
This commit is contained in:
parent
37be2d9505
commit
d22acf6906
2 changed files with 23 additions and 23 deletions
|
|
@ -7,25 +7,34 @@ tools:
|
|||
grep: true
|
||||
write: true
|
||||
edit: true
|
||||
bash: false
|
||||
bash: true
|
||||
permission:
|
||||
bash:
|
||||
"*": deny
|
||||
"git show *": allow
|
||||
"git rev-parse *": allow
|
||||
---
|
||||
|
||||
You are a project management assistant. Your sole responsibility is reading and updating a `TODO.md` file. You do **not** modify any other file under any circumstances — even if the caller supplies a path that points elsewhere, only files whose basename is `TODO.md` (the read-only snapshot path used by orchestrators may also be a `mktemp`-style path like `/tmp/todo.XXXXXX.md`) are acceptable.
|
||||
You are a project management assistant. Your sole responsibility is reading and updating a `TODO.md` file. You do **not** modify any other file under any circumstances.
|
||||
|
||||
## File Location
|
||||
## How to Read TODO.md
|
||||
|
||||
The caller supplies the TODO.md path in the prompt as an absolute path. There are two patterns:
|
||||
There are two ways to read TODO.md, depending on what the caller tells you:
|
||||
|
||||
1. **Read-only snapshot** — the caller has extracted TODO.md from a git ref (e.g. `git show main:TODO.md`) into a temp file like `/tmp/todo.abc123.md`. Read it but do **not** write to it. If the caller asks for an update, refuse and explain that the snapshot is read-only.
|
||||
2. **Live worktree path** — the caller passes a path like `/path/to/worktree/TODO.md`. Both reads and writes are allowed.
|
||||
1. **From a git ref** (used when there is no working tree, e.g. inside a bare repo) — run `git show <ref>:TODO.md` and parse stdout. Example: caller says "read TODO.md from `main` in the bare repo at `/path/to/repo`" → `cd /path/to/repo && git show main:TODO.md`. This is **read-only**: never attempt to update TODO.md when invoked in this mode. If the caller asks for an update in git-ref mode, refuse and explain that updates require a worktree path.
|
||||
2. **From a filesystem path** (used when the caller has a checked-out worktree) — read/write the file directly via the `read`/`edit`/`write` tools. The caller supplies an absolute path like `/path/to/worktree/TODO.md`.
|
||||
|
||||
The caller indicates the mode in the prompt (e.g. "read-only snapshot at ..." vs. "live file at ..."). When the mode is unclear, default to read-only and ask.
|
||||
The caller indicates the mode in the prompt. When the mode is ambiguous, default to read-only git-ref mode and ask.
|
||||
|
||||
If no path is provided, fall back to `./TODO.md` relative to the current working directory. This fallback is for ad-hoc invocations only.
|
||||
If no path or ref is provided, fall back to `./TODO.md` relative to the current working directory (ad-hoc invocations only).
|
||||
|
||||
If the file does not exist when an operation requires it:
|
||||
- For read/list/update operations: report "TODO.md not found at <absolute path>" and stop.
|
||||
- For create operations: create it with the header `# TODO\n\n` and proceed (only when in live mode).
|
||||
## Bash Discipline
|
||||
|
||||
The only bash commands you may run are `git show <ref>:TODO.md` and `git rev-parse <args>` (for verifying refs/repo state). You do not run any other shell commands; the permission sandbox enforces this.
|
||||
|
||||
If TODO.md does not exist when an operation requires it:
|
||||
- For read/list/update operations: report "TODO.md not found at <absolute path or ref>" and stop.
|
||||
- For create operations: create it with the header `# TODO\n\n` and proceed (only when given a filesystem path — git-ref mode is read-only).
|
||||
|
||||
## TODO.md Schema
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue