Skip to content

docs: engineering standards — toolchain, architecture level, agentic harness - #2

Merged
hellices merged 1 commit into
mainfrom
engineering-standards
Jul 23, 2026
Merged

docs: engineering standards — toolchain, architecture level, agentic harness#2
hellices merged 1 commit into
mainfrom
engineering-standards

Conversation

@hellices

Copy link
Copy Markdown
Owner

What

Declares how korvid code will be developed, before the first implementation line. Three artifacts:

  1. docs/specs/2026-07-24-korvid-engineering-standards.md — the standards spec:

    • §1 Toolchain: uv + hatchling + Ruff (lint/format/imports in one tool) + mypy --strict (+ ty as a non-blocking CI job, FastAPI-style) + pytest/pytest-textual-snapshot/pytest-randomly, all configured in a single pyproject.toml. Explicit reject list (black/isort, DI containers, pluggy, commitizen, interrogate, radon, mutation testing, pyrefly)
    • §2 Clean-code rules: src layout, typed public API, no bare type: ignore, complexity ≤ 10, warnings-as-errors in tests
    • §3 Architecture — pragmatic layered: evidence-based verdict from examining posting, harlequin, pydantic-ai, marimo, litellm, aider — 0 of 6 use a DI container; the winning pattern is abc.ABC boundary interfaces + constructor injection at a composition root + entry_points plugins. UI Bus rides Textual Messages (harlequin's pipeline pattern); core/agent/k8s stay Textual-free; litellm's monolithic router identified as the anti-pattern to avoid. Full hexagonal rejected as unneeded ceremony; conventions-only rejected because agent-written code needs structural gates
    • §4 Quality gates in 3 layers: harness hooks (<1 s) → pre-commit (<10 s, no tests) → CI (full matrix + tach + deptry + coverage 80%)
    • §5 Agentic harness: what lives where — AGENTS.md behavior contract / .claude hooks (auto-format, protected-file blocking, stop-tests, post-compaction context) / unbypassable repo gates
  2. AGENTS.md — the agent behavior contract (cross-harness standard): commands, layer table, style rules agents most often violate, workflow economics ('don't run full checks between edits'), PR rules, security invariants from the design doc

  3. CLAUDE.md — one line, @AGENTS.md (uv/marimo delegation pattern)

Why now

Phase 1 implementation planning is next; the gates must exist before the first scaffold so all agent-written code lands inside them (adoption order in §6).

Research basis

Two dedicated research passes (2026-07-24): (a) modern Python tooling incl. agentic-development hooks across Textual/posting/FastAPI/pydantic/pydantic-ai/marimo/uv; (b) architecture level of fast-rising projects incl. harlequin's entry_points adapter system and pydantic-ai's Model/Provider ABCs. Citations inline in the spec.

…re, agentic harness

Research-validated (2026-07) against Textual, posting, harlequin,
FastAPI, pydantic, pydantic-ai, marimo, litellm, aider, uv:

- Toolchain: uv + hatchling + Ruff (lint/format/imports) + mypy --strict
  (+ ty as non-blocking CI) + pytest stack, all configured in a single
  pyproject.toml. Rejected: black/isort, DI containers, pluggy,
  commitizen, interrogate, radon, mutation testing
- Architecture: pragmatic layered — abc.ABC interfaces at boundaries,
  constructor injection at the composition root (no DI container:
  0 of 6 examined projects use one), UI Bus on Textual Messages
  (harlequin pipeline pattern), core/agent/k8s Textual-free,
  entry_points plugins (korvid.provider/panel/tool)
- Quality gates in three layers: harness hooks (<1s) → pre-commit
  (<10s, no tests) → CI (full matrix + tach + deptry + coverage)
- Agentic harness: AGENTS.md behavior contract (CLAUDE.md delegates
  via @AGENTS.md), Claude Code hooks for auto-format/protected-files/
  stop-tests, repo gates unbypassable regardless of harness

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR establishes korvid’s development standards and agent/harness expectations before implementation begins, aligning tooling, architecture boundaries, and quality gates with an agent-first workflow.

Changes:

  • Adds an engineering standards spec covering toolchain, layered architecture, and quality gates.
  • Introduces a repo-root AGENTS.md contract for agent behavior (commands, layer rules, security invariants).
  • Adds CLAUDE.md as a minimal pointer to AGENTS.md for Claude Code compatibility.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
docs/specs/2026-07-24-korvid-engineering-standards.md Defines the proposed toolchain, architecture layering rules, and agentic development gate model.
AGENTS.md Provides a concise agent-facing contract (commands, layer boundaries, style/test rules, PR/security invariants).
CLAUDE.md Delegates Claude Code guidance to the shared AGENTS.md contract.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

|---|---|---|
| PostToolUse (Edit\|Write, `*.py`) | after each edit | `uv run ruff check --fix` + `ruff format` on the file — agent never sees lint noise in review |
| PreToolUse (Edit\|Write) | before each edit | **block** edits to protected paths: `uv.lock`, `.github/workflows/`, `tach.toml`, `.pre-commit-config.yaml` (exit 2). Agents must ask the human to change gate files |
| Stop | agent finishes a turn | `uv run pytest -x -q --tb=short \| tail -20` — failures land in the agent's context immediately |
@hellices
hellices merged commit 578add7 into main Jul 23, 2026
@hellices
hellices deleted the engineering-standards branch July 23, 2026 16:21

@my-reviewer-agent my-reviewer-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문서 전용 PR(엔지니어링 표준 + AGENTS.md/CLAUDE.md) 리뷰입니다. 툴체인 선정 근거, tach 기반 레이어 강제, 3계층 품질 게이트, 에이전트 하니스 설계가 모두 실제 프로젝트 사례를 인용하며 일관되게 정리되어 있습니다. 코드 변경이 없어 버그/보안 관점 이슈는 없고, 문서 간 사소한 불일치 1건만 인라인으로 남깁니다. 승인합니다.


The cross-harness standard file (read natively by Copilot/Codex-family tools; Claude Code reads it via `CLAUDE.md` containing the single line `@AGENTS.md` — the uv/marimo pattern). Contents:

- Quick setup + the exact dev commands (`make lint / format / typecheck / test`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion — §5.1은 AGENTS.md에 make lint / format / typecheck / test 명령이 담긴다고 기술하지만, 이 PR의 AGENTS.md는 uv run ruff/mypy/pytest ... 직접 호출만 나열하고 Makefile 언급이 없습니다 (Makefile은 §6의 scaffold PR에서 도입 예정). 에이전트가 아직 없는 make 타깃을 실행하려다 실패하지 않도록, 두 문서 중 한쪽으로 표현을 맞추거나 "Makefile 도입 후 갱신" 각주를 추가하는 것을 제안합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants