---
description: "Edit `.hivemind/configs.json` governance rules interactively or via flags. Routes to hm-config-edit workflow. Supports --add, --remove, --set-action, --validate, --list. Triggers: 'edit config', 'governance rule', 'add rule', 'remove rule', 'set action type', 'validate config', 'list rules'."
agent: hm-platform-references
tools:
  - delegate-task
  - delegation-status
  - configure-primitive
  - hivemind-steer
  - hivemind-doc
  - hivemind-command-engine
subtask: true
---

<objective>
Step-by-step user-facing editor for `.hivemind/configs.json` `governance.rules[]`.
Routes to the `hm-config-edit` workflow under `assets/workflows/hm-config-edit.md`.
Validates after every change against `.hivemind/configs.schema.json`.

Flags:
- `--list` — print all current rules and exit.
- `--add <id>` — start an interactive add flow for a new rule.
- `--remove <id>` — remove a rule by id.
- `--set-action <id>=<type>` — change a rule's action.type in-place. type ∈ allow|warn|block|escalate|needs_jit_grant.
- `--validate` — only validate the config; no edits.
- `--dry-run` — show what would change; don't write.
- `--scope <user|project>` — write to `~/.hivemind/configs.json` (user) or `./.hivemind/configs.json` (project, default).
</objective>

<context>
$ARGUMENTS
</context>

<process>
1. Parse $ARGUMENTS for the flags above. If no flag, fall through to interactive mode.
2. Delegate to `hm-platform-references` agent with the parsed args + path to the workflow doc.
3. The agent loads `assets/workflows/hm-config-edit.md` and walks the user through:
   - Read current config (project or user scope)
   - Locate the affected rule (by id) or insert point (for --add)
   - Apply the change (or simulate if --dry-run)
   - Validate via `validateConfigsFile(projectRoot)`
   - Show before/after diff
   - Commit message suggestion
4. On `--list`, the workflow prints a table of all rules and exits.
5. On `--validate` failure, surface the error path and offer to auto-fix or roll back.
</process>

<success_criteria>
- Every change leaves `.hivemind/configs.json` in a state that passes `validateConfigsFile()`.
- Every action.type value is one of: allow | warn | block | escalate | needs_jit_grant.
- Engine rule IDs (`R1-malformed-task`, `R2-child-recursive-task`, `R4-delegate-task-code-intent`, `default`) are recognized and consumed.
- Diff is shown to the user before any write.
- The user can `git diff .hivemind/configs.json` to review the change.
</success_criteria>

<failure_modes>
- Unknown rule id: print available ids and exit non-zero.
- Invalid action.type: print valid set and exit non-zero.
- JSON parse error: quarantine via `.hivemind/quarantine/<ts>-configs.json` and offer rollback.
- Schema validation fails: print issue path, do not write.
</failure_modes>
