Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
smoke:
# A real omp loads plugins/pstack through -e, `omp plugin link`, and a local marketplace install,
# and runs scripted turns: every skill registers, the pinned prompt names poteto-mode, and
# pstackpolicy refuses a merge before gh runs. omp-port/smoke-plugin.mjs names each check.
# pstackpolicy refuses a force-push to main and `gh pr merge` still reaches gh. omp-port/smoke-plugin.mjs names each check.
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand Down
4 changes: 2 additions & 2 deletions .omp-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
},
"metadata": {
"description": "pstack, poteto's engineering methodology for Cursor, ported to oh-my-pi. Model and provider agnostic.",
"version": "0.15.4801"
"version": "0.15.4802"
},
"plugins": [
{
"name": "pstack",
"description": "60 skills, 22 playbooks, 24 principles, the poteto-mode pin, and two agents. Upstream cursor/plugins pstack 0.15.48 at 9e278fe.",
"version": "0.15.4801",
"version": "0.15.4802",
"category": "development",
"license": "MIT",
"source": "./plugins/pstack"
Expand Down
19 changes: 10 additions & 9 deletions .omp/skills/verify-pstack-omp/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Drive the pstack plugin inside a real, isolated omp TUI and the por

Users meet this repo in two places.

- The plugin tree `plugins/pstack` loaded into omp. Users type skills as `/skill:<name>`, pin poteto-mode with the `potetomode` extension, and run under the `pstackpolicy` extension, which refuses forge mutations in model-issued `bash` and `eval` calls unless `PSTACK_LANDING_GRANT=1`. This is the primary target.
- The plugin tree `plugins/pstack` loaded into omp. Users type skills as `/skill:<name>`, pin poteto-mode with the `potetomode` extension, and run under the `pstackpolicy` extension, which refuses a force-push to the default branch or to main, master, or trunk, and repository deletion, in model-issued `bash` and `eval` calls. Everything else, merges included, is the playbooks' work and passes. This is the primary target.
- The maintainer's port CLI, `omp-port/check-port.sh` and `omp-port/sync-upstream.sh`.

`omp-port/smoke-plugin.mjs` is CI's RPC check for registration and the pin. This skill reuses its isolation recipe (scratch HOME, stripped environment, `--plugin-dir` plus `-e` on the same tree, a local provider in `models.yml`) and adds a TUI in tmux plus a scripted model, so a drive can make omp issue real tool calls.
Expand All @@ -22,15 +22,15 @@ P=.omp/skills/verify-pstack-omp/prompts
## Launch

```bash
$C launch <run> [--grant] [-- <extra omp flags>]
$C launch <run> [-- <extra omp flags>]
```

`<run>` is 1 to 40 characters of `[a-z0-9-]`, one per drive. Launch refuses a run id whose scratch dir or tmux server already exists. It does this:

1. Creates scratch `${TMPDIR:-/tmp}/verify-pstack-omp-<run>/` with `home/` as omp's HOME, `work/` as its cwd, and `bin/gh`, a shim that appends its argv to `gh-calls.log` and never touches the network.
1. Creates scratch `${TMPDIR:-/tmp}/verify-pstack-omp-<run>/` with `home/` as omp's HOME, `work/` as its cwd, `bin/gh`, a shim that appends its argv to `gh-calls.log` and never touches the network, and `bin/git`, a shim that logs any `push` to `git-calls.log` and exits without pushing, and runs the real git for every other command.
2. Writes `home/.omp/agent/config.yml` with `setupVersion: 2`, which skips omp's first-run login wizard.
3. Starts a private tmux server, `tmux -L verify-pstack-omp-<run> -f /dev/null`. Session `model` runs `scripts/scripted-model.mjs` on a free loopback port. `models.yml` names it as provider `verify`, model `scripted`.
4. Starts session `omp` under `env -i` with only HOME, USER, TERM, LANG, SHELL, and PATH, with the scratch `bin` first. `--grant` adds `PSTACK_LANDING_GRANT=1`. The flags are `--no-session --no-title --no-lsp --no-rules --no-extensions --plugin-dir <plugin> -e <plugin> --model verify/scripted --approval-mode yolo`. yolo is the mode pstackpolicy exists for.
4. Starts session `omp` under `env -i` with only HOME, USER, TERM, LANG, SHELL, and PATH, with the scratch `bin` first. The flags are `--no-session --no-title --no-lsp --no-rules --no-extensions --plugin-dir <plugin> -e <plugin> --model verify/scripted --approval-mode yolo`. yolo is the mode pstackpolicy exists for.
5. Waits up to 30s for the status line to name `scripted`, which means omp accepts input. It took about 2s on this host. Launch then writes `launch.txt` to the evidence dir and prints the attach command.

Overrides are `VERIFY_OMP_BIN` (default `omp` on PATH), `VERIFY_PSTACK_PLUGIN` (default this checkout's `plugins/pstack`), and `VERIFY_PSTACK_EVIDENCE` (the evidence root).
Expand All @@ -47,7 +47,7 @@ Teardown is [Cleanup](#cleanup).
$C doctor <run>
```

Read-only. It prints one `ok` or `FAIL` line per check and exits 1 on any FAIL. It checks that both tmux sessions exist, the omp pane is alive and runs `VERIFY_OMP_BIN` at the printed version, omp loads the expected plugin path, omp's HOME is the scratch home, omp's environment holds no credential or omp root variable, the scripted model answers `/health`, and the status line names `scripted`. The last line reports `grant armed` or `grant absent`. Run it first, and again whenever a drive surprises you.
Read-only. It prints one `ok` or `FAIL` line per check and exits 1 on any FAIL. It checks that both tmux sessions exist, the omp pane is alive and runs `VERIFY_OMP_BIN` at the printed version, omp loads the expected plugin path, omp's HOME is the scratch home, omp's environment holds no credential or omp root variable, the scripted model answers `/health`, the status line names `scripted`, and omp's environment holds no `PSTACK_` variable. Run it first, and again whenever a drive surprises you.

## Drive

Expand All @@ -69,7 +69,7 @@ $C capture <run> <name> # evidence snapshot, see below

`wait` reads the whole pane with scrollback and succeeds only when it holds more matching lines than it did at the last `press`. So a second `wait 'tool result received'` waits for the second turn instead of matching the first. Wait on output the action produces, never on text you typed, because the typed text moves from the editor into the transcript and the count does not grow.

Type a prompt that names a forge mutation with `type-file`. When the agent driving this skill runs omp with pstack installed, pstackpolicy reads that agent's own bash command line too, so `$C type <run> '...gh pr merge...'` is refused in the driver's session and never reaches tmux. `prompts/` holds every such prompt.
Type a prompt that names a force-push to trunk or a repository delete with `type-file`. When the agent driving this skill runs omp with pstack installed, pstackpolicy reads that agent's own bash command line too, so `$C type <run> '...git push --force origin main...'` is refused in the driver's session and never reaches tmux. `prompts/` holds every such prompt.

Editor handles that the recipes rely on:

Expand All @@ -82,11 +82,12 @@ Editor handles that the recipes rely on:

Evidence goes to `${VERIFY_PSTACK_EVIDENCE:-${XDG_STATE_HOME:-$HOME/.local/state}/verify-pstack-omp}/<run>/`. It is outside the repository and the scratch dir, and cleanup never removes it. `$C evidence <run>` creates and prints it.

- `launch.txt` names the run, the omp binary and version, the plugin path, its git HEAD with a dirty-file count, the grant, the extra flags, and the scratch path.
- `launch.txt` names the run, the omp binary and version, the plugin path, its git HEAD with a dirty-file count, the extra flags, and the scratch path.
- `actions.log` timestamps every launch, type, type-file, press, capture, clone, and cleanup.
- `<name>.pane.txt` is the whole pane with scrollback, so it holds the typed prompt, the tool block, and its output.
- `<name>.model-requests.jsonl` is every request omp sent the model, so it holds the system prompt and the tool result the agent got back.
- `<name>.gh-calls.log` is the argv of every `gh` call that reached a shell. An empty file means none did.
- `<name>.git-calls.log` is the argv of every `git push` that reached a shell. An empty file means none did.
- `omp-logs/` is omp's own log directory, copied at cleanup.

For the port CLI, `tee` the command's stdout and stderr into the evidence dir, append its exit code, and save `git status --porcelain` before and after.
Expand All @@ -95,8 +96,8 @@ Proof standards:

- Drive through the TUI the way a user does, with typed prompts and slash commands. Importing an extension module is the unit tests' job (`plugins/pstack/extensions/*/index.test.js`), not this skill's.
- Capture the action and the resulting state. The pane shows the prompt and the result, and the model log shows what the agent received.
- Verify side effects. A refusal proof needs an empty `gh-calls.log` plus a control in which the same launch reaches the shim, through an allowed command or the same command under `--grant`. Without the control, an empty log could also mean the shim was never on PATH.
- The scripted model and the `gh` shim are the only stand-ins. The model replaces the provider at its HTTP boundary. The shim replaces `gh` on PATH, so a gate failure cannot reach the forge. omp, the plugin, both extensions, and the bash and eval tools are real.
- Verify side effects. A refusal proof needs an empty `git-calls.log` or `gh-calls.log` for the refused command plus a control in which the same launch reaches the shim through an allowed command. Without the control, an empty log could also mean the shim was never on PATH.
- The scripted model and the `gh` and `git` shims are the only stand-ins. The model replaces the provider at its HTTP boundary. The shims replace `gh` and the push half of `git` on PATH, so a gate failure cannot reach the forge. omp, the plugin, both extensions, and the bash and eval tools are real.
- Skip model requests whose `tools` list is empty when asserting. Those are omp compressing skill descriptions in the background.
- `sync-upstream.sh <sha>` and `rebuild` rewrite the checkout. Run them only inside `$C clone <run>`, and read the result with `git status --porcelain` and `git diff --stat` there.

Expand Down
8 changes: 4 additions & 4 deletions .omp/skills/verify-pstack-omp/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This directory is the maintained source for verifying what users of pstack-omp c

## Driving conventions

- Type prompts that name a forge mutation with `$C type-file`, never inline. The driver's own pstackpolicy refuses an inline one.
- Type prompts that name a force-push to trunk or a repository delete with `$C type-file`, never inline. The driver's own pstackpolicy refuses an inline one.
- Wait on visible text with `$C wait`, not on a fixed sleep. The pane strings each recipe names are stable output of the plugin or omp.
- Assert on model requests whose `tools` list is non-empty. Requests with an empty list are background skill-description compression.
- Run anything that rewrites `plugins/pstack` inside `$C clone <run>`, never in the checkout.
Expand All @@ -20,9 +20,9 @@ This directory is the maintained source for verifying what users of pstack-omp c
## Proof and skip reporting

- Capture the user action and the resulting state with `$C capture <run> <name>`, not only the final screen.
- A refusal proof pairs an empty `<name>.gh-calls.log` with a control capture in which the same launch reaches the `gh` shim.
- A refusal proof pairs an empty `<name>.git-calls.log` or `<name>.gh-calls.log` with a control capture in which the same launch reaches the `gh` or `git` shim.
- Port proof includes the command, stdout and stderr, the exit code, and `git status --porcelain` before and after.
- Record the feature file and sub-feature ID in the capture name, for example `landing-gate.gate-refuse-bash`.
- Record the feature file and sub-feature ID in the capture name, for example `irreversible-action-gate.gate-refuse-force-push`.
- Report an unreachable path with the attempted command and the unmet precondition.
- Do not report a skipped entry point as verified through a different path.

Expand All @@ -41,6 +41,6 @@ Keep implementation details out of the map. Name only user paths, stable handles

- [Skill commands](./skill-commands.md) covers registration of every skill directory, `/skill:` autocomplete, and invoking a skill.
- [poteto-mode pin](./poteto-mode-pin.md) covers `/poteto-mode`, the status pill, the per-turn reminder, the `--poteto` flag, the shortcut, and `/new`.
- [Landing gate](./landing-gate.md) covers pstackpolicy refusing forge mutations from model-issued `bash` and `eval` calls, the allowed control, the grant, and the user's own `!` commands.
- [Irreversible-action gate](./irreversible-action-gate.md) covers pstackpolicy refusing a force-push to the default branch and repository deletion from model-issued `bash` and `eval` calls, the allowed merge and feature-push controls, and the user's own `!` commands.
- [Port gate](./port-gate.md) covers `omp-port/check-port.sh` at the pin and against another upstream sha.
- [Upstream sync](./upstream-sync.md) covers `omp-port/sync-upstream.sh check`, `rebuild`, and a sync to a target sha.
44 changes: 44 additions & 0 deletions .omp/skills/verify-pstack-omp/features/irreversible-action-gate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Irreversible-action gate

The pstackpolicy extension refuses two irreversible actions that the model issues through the `bash` or `eval` tool, a force-push to the repository's default branch or to main, master, or trunk, and deleting the repository. These are the two items of upstream's pause list that a command can show. The refused command never runs. The agent receives the refusal as its tool result and is told to stop and return the step to the operator. Everything else passes, merges included, because the operator's prompt is the permission to land.

## Sub-features

- `gate-refuse-force-push` refuses a model `bash` call that force-pushes main, past the global option, and git never pushes.
- `gate-refuse-eval` refuses a model `eval` cell that force-pushes main through a Python argv list with `--force-with-lease` and a `+` refspec.
- `gate-refuse-repo-delete` refuses a model `bash` call that deletes the repository through the API.
- `gate-agent-told` returns the refusal text to the agent as the tool result, with the instruction to return the step to the operator.
- `gate-allow-merge` lets a `gh pr merge` reach the `gh` shim in the same session.
- `gate-allow-feature-push` lets a force-push to a feature branch reach the `git` shim.
- `gate-user-bang` leaves the user's own `!` command ungated, because the operator typed it.

## How to get to it (user POV)

- Ask the agent to do something that ends in a force-push to the default branch or a repository delete. The gate fires when the model's tool call carries the command.
- Ask the agent to merge a pull request or force-push a feature branch. Nothing fires.
- Type `!<command>` to run a shell command yourself.

## Driving it with control-pstack

Preconditions:

- `$C launch gate-<n>` succeeded, and `$C doctor gate-<n>` prints no `FAIL`, including the line that omp's environment holds no `PSTACK_` variable.
- The run id is new, so `$C evidence gate-<n>` prints a directory that did not exist before.

- **Refuse a bash force-push.** Run `$C type-file gate-<n> $P/gate-force-push-main.txt`, `$C press gate-<n> Enter`, `$C wait gate-<n> 'refused force-pushing a default or trunk branch'`, `$C wait gate-<n> 'tool result received'`, and `$C capture gate-<n> irreversible-action-gate.gate-refuse-force-push`. The pane shows the typed `tool:bash` prompt, a tool block whose command line is `git -C . push --force origin main`, and output starting `pstackpolicy: refused force-pushing a default or trunk branch.` `irreversible-action-gate.gate-refuse-force-push.git-calls.log` is empty.
- **Agent receives the refusal.** Run `jq -r 'select(.body.messages[-1].role=="tool") | .body.messages[-1].content' "$($C evidence gate-<n>)/irreversible-action-gate.gate-refuse-force-push.model-requests.jsonl"`. It prints the same `pstackpolicy: refused` text, which ends with `Stop here and return this step to the operator`.
- **Refuse an eval force-push.** Run `$C type-file gate-<n> $P/gate-eval-force-push.txt`, `$C press gate-<n> Enter`, `$C wait gate-<n> 'refused force-pushing a default or trunk branch'`, `$C wait gate-<n> 'tool result received'`, and `$C capture gate-<n> irreversible-action-gate.gate-refuse-eval`. The pane shows the `tool:eval` prompt followed by the refusal. The git-calls log is still empty.
- **Refuse a repository delete.** Run `$C type-file gate-<n> $P/gate-repo-delete.txt`, `$C press gate-<n> Enter`, `$C wait gate-<n> 'refused deleting the repository'`, `$C wait gate-<n> 'tool result received'`, and `$C capture gate-<n> irreversible-action-gate.gate-refuse-repo-delete`. The gh-calls log is empty.
- **Allowed merge.** Run `$C type-file gate-<n> $P/gate-merge.txt`, `$C press gate-<n> Enter`, `$C wait gate-<n> 'gh-shim: pr merge'`, `$C wait gate-<n> 'tool result received'`, and `$C capture gate-<n> irreversible-action-gate.gate-allow-merge`. The tool block output is `gh-shim: pr merge 1 --repo pstack-verify/no-such-repo --squash`, and that capture's gh-calls log has exactly that one line. This is the control that proves the shim was reachable while the refusals above ran.
- **Allowed feature push.** Run `$C type-file gate-<n> $P/gate-feature-push.txt`, `$C press gate-<n> Enter`, `$C wait gate-<n> 'git-shim: -C . push'`, `$C wait gate-<n> 'tool result received'`, and `$C capture gate-<n> irreversible-action-gate.gate-allow-feature-push`. The git-calls log has exactly `-C . push --force-with-lease origin feature/verify`.
- **User bang command.** Run `$C type-file gate-<n> $P/user-bang-force-push.txt`, `$C press gate-<n> Enter`, `$C wait gate-<n> 'git-shim: push --force origin main'`, and `$C capture gate-<n> irreversible-action-gate.gate-user-bang`. The pane shows the shim output with no model turn after it, and the git-calls log gains a `push --force origin main` line.
- **Clean up.** Run `$C cleanup gate-<n>`, then `ls` the evidence dir.

## Gotchas

- The driver's own pstackpolicy refuses an inline prompt or a `grep` whose command line contains a force-push to main. Use `type-file` for prompts and read evidence with `read` or a pattern such as `'push --force'`.
- The shim logs are cumulative for a run. Capture each refusal before the allowed controls, or the refusal capture shows the control's line.
- Wait for `tool result received` before typing the next prompt, so each capture holds one finished turn.
- The gate reads only model-issued `bash` and `eval` calls. The user's `!` command, the `browser` and `computer` preludes, and a command built by string concatenation inside a cell are outside it by design.
- The scratch `work/` directory is not a git checkout, so a force-push to a feature branch passes because the extension finds no default branch and no checked-out trunk there.
- The prompts target `pstack-verify/no-such-repo`. If the shims were missing, the real `gh` would still fail, since the scratch HOME has no login.
Loading