Skip to content

Escalate unrecognized command forms to a prompt and accept ordinary commit messages #158

Closed

Description

@furedea

Purpose

Reduce the friction the agent harness adds to ordinary Git delivery (add, commit, push, PR creation) without widening any hard denial. Today an allow-prefixed command whose form is not in the precise allowlist is refused outright by guard_command.py allowed (exit 2), and so is every command that shell_syntax cannot inspect statically. Neither path can reach the human.

Audit evidence (2026-10-08 to 2026-10-15): 5238 tool calls observed, 474 blocked; 242 of the blocks are allowed-rule mismatches, 118 forbidden rules, 112 dangerous Git.

Scope

  1. Match precise command rules against whole shell segments (grep --null-data) instead of line by line. This closes a bypass where a multi-line quoted argument passes when any inner line matches an allowed pattern, and lets multi-line quoted commit messages match anchored rules.
  2. Accept any number of -m arguments with single or double quotes, mixed, for git commit and git commit --amend.
  3. Return permissionDecision: ask instead of exit 2 when an allow-prefixed command does not match a precise rule, or when the command cannot be inspected statically. Keep exit 2 for forbidden regex rules, deny prefixes, dangerous Git operations, and secret policies. Non-Claude adapters keep blocking until their hook output formats support prompts.
  4. Resolve $HOME and a leading ~ statically in shell inspection, so the verification commands documented in the git-workflow skill are inspectable.
  5. In the verification scope check, allow Write/Edit targets and directory changes under the session temp directories (TMPDIR, CLAUDE_TMPDIR), and prompt rather than deny for other out-of-worktree targets. Registration failures stay denied.
  6. Record escalations in the audit log with the governed prefix so later rule widening is evidence-based.
  7. State the canonical commit command form in the git-workflow skill and record the decision in an ADR.

Out of scope

  • Changes to the agent-harness renderer (furedea/agent-harness).
  • Prompt support in the Codex, Devin, Hermes, and pi adapters.
  • The stale untracked .cc-overlap-tmp/ directory and the uncommitted host-name revert in the working tree.

Acceptance criteria

  • uv run --frozen pytest tests/agents passes.
  • A multi-line double-quoted commit message with a trailer passes the allowed-command guard; a multi-line argument whose inner line matches an allowed pattern no longer passes.
  • An allow-prefixed but unlisted form such as gh pr review 42 --approve exits 0 with an ask decision on Claude and still exits 2 through the Codex adapter.
  • "$HOME/.claude/hooks/verification_session.py" status <record> and cd ~/x are parsed; ~user and other expansions are still escalated.
  • A Write under $TMPDIR passes the scope check in a registered session; a cd to a sibling repository asks instead of denying.
  • After home-manager switch, an allow-prefixed unlisted command shows a permission prompt in an interactive Claude Code session (manual check, documented in the PR).

Activity

  1. furedea commented on Oct 15, 2026

    @furedea
    OwnerAuthor

    Implementation is in #159 (branch feat/escalate-unrecognized-command-forms).

    Status against the scope:

    • Done: whole-segment rule matching, repeated and mixed-quote commit messages, ask instead of exit 2 for unlisted allow-prefixed forms and uninspectable commands, static $HOME and ~, temp directories in the verification scope with ask for other outside targets, audit detail labels, commit form in the git-workflow skill, ADR-0033, and git commit * excluded from the Claude sandbox so SSH signing works.
    • Still required: after home-manager switch, confirm in an interactive Claude Code session that an allow-prefixed but unlisted form (for example gh pr review 1 --approve) shows a permission prompt instead of a hook error.
    • Not done: adding git push * to the sandbox exclusions. The push credential helper cannot read the gh configuration inside the sandbox, so pushes from an agent session still need the sandbox disabled for that one command. The settings edit was refused by the auto-mode classifier as self-modification; apply it by hand if wanted.
  2. furedea commented on Oct 15, 2026

    @furedea
    OwnerAuthor

    Manual check after home-manager switch passed: an allowed prefix in an unlisted form (cat README.md > /dev/null) showed a permission prompt and ran only after approval, the documented verify-status command with $HOME passed the hook, and a Write into the session scratchpad passed the scope check. #159 now closes this issue on merge.

  3. added a commit that references this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions