docs(openspec): chain-restructuring proposal (reject complex one-liners with guidance) - #17
Open
preved911 wants to merge 5 commits into
Open
docs(openspec): chain-restructuring proposal (reject complex one-liners with guidance)#17preved911 wants to merge 5 commits into
preved911 wants to merge 5 commits into
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
👀 AI Code ReviewSomething went wrong: <urlopen error [Errno -2] Name or service not known> Powered by GPT-4o via GitHub Models |
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
👀 AI Code ReviewSomething went wrong: <urlopen error [Errno -2] Name or service not known> Powered by GPT-4o via GitHub Models |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
OpenSpec change proposal for
chain-restructuring— deterministic steering: the plugin rejects not-allowed complex one-liners with an actionable error, so the agent re-issues them as separate commands or a multi-line script (one command per line), each checked individually. Allowed chains stay allowed — restructuring targets exactly the commands a human must review. Proposal only; implementation follows after review.Why
Not-allowed multi-step commands surface to the human as an unreadable one-liner in the permission dialog, and the agent has no incentive to write readable commands. AGENTS.md instructions are soft (probabilistic, no verification loop).
Verified mechanism (from opencode API research)
permission.askoutput carries only{ status }— no reason field; per issue [FEATURE]: Wire the permission.ask plugin hook anomalyco/opencode#19469 the hook isn't even triggered by the engine in current source. Unusable for steering.tool.execute.before+throwworks: thrown errors become tool results withresultType: "error"and the error text reaches the model (official docs pattern). The model retries in compliant form — a closed deterministic loop.Proposed config — separate plugin file
opencode-bash-guard.jsoncin the opencode config dirs (global~/.config/opencode/, project.opencode/), JSONC with comments, deep-merged project over global. Permission actions stay inopencode.json; plugin behavior tuning lives here.{ // Reject complex one-liners and ask the agent to restructure them "restructure": { "enabled": false, // default false — zero behavior change "max_segments": 3, // max commands in a single-line chain "max_depth": 2 // max $()/backtick/meta-command nesting } }Key design decisions
"*": "ask"prerequisite, "not allowed" ⇔askin practiceparseChain) + max substitution nesting depth (new — catchesecho $(echo $(...))obfuscation)Artifacts
proposal.md— what & whydesign.md— 8 decisions + risks (review decision recorded: restructure applies only to not-allowed commands)specs/chain-restructuring/spec.md— 6 requirements, 26 scenariostasks.md— 6 sections, 29 tasks (incl. new config-loader module +jsonc-parserdep)Out of scope (flagged)
permission.askmay never fire in current opencode (anomalyco/opencode#19469) — the deny path of this plugin may not hard-block. Needs separate verification + possible fix change.Next steps
/opsx-applyto implementUltraworked with Sisyphus