← Back to Pull requests

docs: add agent knowledge base and dev/review skills #13

Open
unknown opened this pull request with 440 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 06, 2026 09:18 UTC
Author

Agents working on Patio (Copilot cloud agent and code review, the CLI, Codex, Cursor, Claude Code) have to rediscover the architecture, the deployment contracts, and the lessons from past reviews on every task. README and doc/ have also drifted from the code in several places. This PR adds a layered knowledge base so development and review agents start from verified facts.

What's included

  • AGENTS.md (always loaded; CLAUDE.md is a symlink to it): repo map, startup/shutdown model, the compatibility-sensitive contracts (HTTP API, env vars and CLI flags, patio: metric names, engine and router protocols, RBG addressing), verified commands, conventions, definition of done, and code that is unused at runtime.

  • .github/instructions/.instructions.md: short path-scoped rules for topo, engine/api/app.py, metrics, and tests. Copilot cloud agent and Copilot code review inject them based on the files a change touches.

  • .agents/skills/patio-dev: development workflow plus playbooks for adding a topology client (the most active area, see #6, #9, #7), an inference engine, or metric rules, with architecture (including Mermaid diagrams), configuration, and testing references.

  • .agents/skills/patio-review*: review procedure, severity rubric, a "don't flag" list based on maintainer decisions in #3, a per-area checklist, and known issues.

  • A short "AI Coding Agents" pointer in the README, and .venv/ added to .gitignore because AGENTS.md tells agents to create one.
  • Skills live in .agents/skills/, which Copilot (cloud agent, code review, CLI, app, VS Code) and other Agent Skills tools read. AGENTS.md also links them directly for tools without skill discovery.

    No runtime code changes.

    How it was verified

  • The commands in AGENTS.md were run on Python 3.12: pip install -e ".[dev]", pytest (61 passed), python tests/run_mock_tests.py, patio --help.

  • Behavioral claims were checked by running them, not only by reading code. Examples: uvicorn signal handling in 0.15, 0.28, and 0.29; pydantic.v1 validators on v2 models; Prometheus counter family names.

  • The skeletons and test templates in the playbooks were extracted and run against the codebase. They pass and are Black-clean.

  • A script confirmed that every referenced path and symbol, and all 53 file:line citations, resolve. All Mermaid diagrams render.

  • An independent review compared every claim with the code. Its 10 findings are fixed.
  • Worth a look

    .agents/skills/patio-review/references/known-issues.md records verified problems that this PR documents but does not fix, so reviewers can flag new code that copies them. Among them:

  • SIGTERM unregister() only runs on uvicorn >= 0.29, but pyproject.toml allows uvicorn>=0.15.0.

  • SGLang unregister() retries 60 x 3 s on the SIGTERM path, which can outlast the pod grace period.

  • The pydantic.v1 validators in api/protocol.py never run on the v2 models.

  • --scrape-engine-metrics false still enables scraping (type=bool). --enable-fastapi-docs is ignored, so /docs is always served.

  • README drift: the RBG_ env var names, the HEARTBEAT_INTERVAL default (10, not 30), a metric mapping that doesn't exist, and INFERENCE_ENGINE_ENDPOINT having no default.
  • These fit better in small follow-up PRs. Under the maintenance rule in AGENTS.md, a PR that fixes one also removes its entry.

    Supersedes #12 (same commit, now opened from the fork branch cheyang:cheyang-agent-knowledge-base).

    Diff: 440 lines (+330 / -110) across 5 files Reviewer: cheyang Review duration: 11343m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 440 lines diff across 5 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.364
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #13"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.3% (MEDIUM) · Higher = larger blast radius
    50.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.8% · Safe to merge
    26.8%