Skip to content

Bash learning: discover repeated shell patterns and support explicit approval before redirecting #42

@willwashburn

Description

@willwashburn

Problem

Wash has a fixed warn-only list for Bash commands with structured equivalents. Over time, users may repeatedly run project-specific shell commands that produce large output and could benefit from structured handling or stronger nudges. Auto-blocking unknown Bash patterns would be risky, but surfacing candidates is useful.

Goal

Teach the learning layer to discover repeated high-waste Bash patterns and present them for explicit approval.

Scope

  • Observe Bash commands that match no existing redirect pattern.
  • Redact or normalize sensitive command parts.
  • Group commands into pattern candidates.
  • Estimate output waste from command result size when available.
  • Write candidates to pendingBashPatterns in the profile.
  • Add an approval command that promotes selected patterns into active redirect hints.

Approval flow

Suggested commands:

  • wash learn bash-candidates
  • wash learn approve-pattern <id>
  • wash learn reject-pattern <id>

Suggested slash command:

  • /wash-approve-patterns

Safety rules

  • Never auto-block a discovered pattern.
  • Never store full commands that include quoted secrets or obvious token values.
  • Prefer normalized patterns such as docker logs <arg> over raw command strings.
  • Approval should be reversible.

Acceptance criteria

  • Repeated unmatched Bash commands are grouped into candidates.
  • Candidates include count, estimated output bytes, and suggested structured replacement when known.
  • Approved patterns produce warn-only hints in PreToolUse.
  • Tests cover grouping, redaction, approval, rejection, and profile persistence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions