Skip to content

Commit e2f1263

Browse files
authored
chore: add write-time quality enforcement rules (t1368) (#2659)
Add prompt-level write-time quality enforcement inspired by Plankton (github.com/alexfazio/plankton). Since OpenCode lacks PreToolUse/ PostToolUse hooks (tracked: anomalyco/opencode#12472, PR #11525), enforce via prompt discipline: - Soft linter config protection: fix code not rules, but allow documented config changes for legitimate project patterns - Per-edit linting: run relevant linter after each file edit rather than batching violations to commit time - Reference write-time enforcement in AGENTS.md quality pipeline
1 parent 8c6f2f3 commit e2f1263

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎.agents/AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Key capabilities (details in `reference/orchestration.md`, `reference/services.m
210210
- **Skills**: `aidevops skills`, `/skills`
211211
- **Auto-update**: GitHub poll + daily skill/repo sync
212212
- **Browser**: Playwright, dev-browser (persistent login)
213-
- **Quality**: `linters-local.sh` → `/pr review` → `/postflight`. Bundle `skip_gates` filter irrelevant checks per project type.
213+
- **Quality**: Write-time per-edit linting → `linters-local.sh` → `/pr review` → `/postflight`. Fix violations at edit time, not commit time. See `prompts/build.txt` "Write-Time Quality Enforcement". Bundle `skip_gates` filter irrelevant checks per project type.
214214
- **Sessions**: `/session-review`, `/checkpoint`, compaction resilience
215215

216216
## Security

‎.agents/prompts/build.txt‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,22 @@ Git is the primary audit trail for all work. Every change should be discoverable
204204
- Explicit returns in all functions
205205
- Conventional commits: feat:, fix:, docs:, refactor:, chore:, perf:
206206

207+
# Write-Time Quality Enforcement
208+
# Inspired by Plankton (github.com/alexfazio/plankton) — adapted for runtime-agnostic use.
209+
# Plankton uses Claude Code PostToolUse hooks to lint on every edit. OpenCode does not yet
210+
# have equivalent hooks (feature requested: anomalyco/opencode). Until then, enforce via
211+
# prompt-level discipline and explicit tool calls.
212+
#
213+
# Linter config protection (soft rule):
214+
- When a linter reports violations, fix the code — not the linter config.
215+
- If a rule is genuinely wrong for the project (false positive, architectural pattern), modifying the config is acceptable — but document the rationale in a comment in the config file and in the commit message. Never disable a rule solely to silence a violation.
216+
- Existing config customisations (e.g., .shellcheckrc disables, .markdownlint.json overrides) are intentional project decisions. Respect them; don't revert without understanding why they exist.
217+
#
218+
# Per-edit quality feedback:
219+
- After editing code files (shell, Python, TypeScript, markdown), run the relevant linter on the modified file before proceeding to the next edit. For shell: `shellcheck <file>`. For markdown: `markdownlint-cli2 <file>`. For project-wide: `linters-local.sh`.
220+
- Fix violations immediately rather than accumulating them for a batch fix at commit time. Write-time feedback produces better code than post-hoc correction.
221+
- When available, use the `quality-check` MCP tool or `linters-local.sh` for comprehensive checks before committing.
222+
207223
# Agent Framework
208224
- Agents are defined in `~/.aidevops/agents/`
209225
- Subagents provide domain expertise (read on demand, not upfront)

0 commit comments

Comments
 (0)