Skip to content

Latest commit

 

History

History
342 lines (241 loc) · 16.5 KB

AGENTS.md

File metadata and controls

342 lines (241 loc) · 16.5 KB

AGENTS.md

hash: 29d9ac099b64 path: .specify/memory/constitution.md

Chirograph Constitution

Chirograph generates typed HTTP clients from OpenAPI documents at build time. A project declares a client with one OpenApiClient MSBuild item and gets a compiled Kiota or Refitter client, registered with IHttpClientFactory. The words below (client, source, document, generator, registration, joint) mean what GLOSSARY.md says. The design and its decisions are in plans/chirograph.md.

Core Principles

I. An MSBuild SDK, and nothing else

Chirograph ships one package, Chirograph, of package type MSBuildSdk: props, targets and templates under Sdk/, and the assembly of its MSBuild tasks, Chirograph.Build.Tasks, under Sdk/tasks/netstandard2.0. It ships no runtime library and no source generator. The generators run as processes during the build, fetched with PackageDownload. The tasks follow Dovetail's pattern: one netstandard2.0 assembly that compiles against MSBuild only and is never a package of its own. Logic goes into a task when MSBuild's own tasks and property functions express it badly; the targets keep the data, the checks and the diagnostics.

II. Behaviour is pinned by end-to-end tests

Every behaviour is proven by building a real consumer project against the packed SDK: test/Chirograph.Tests packs src/** before it builds and scaffolds consumers with MSBuild.ProjectCreation. Tests observe what a consumer sees (generated files, build output, diagnostics, the registered client), never the targets' internals. Snapshots use Verify on the observable result only.

III. Diagnostic codes are public API

The CHIROnnn codes, the OpenApiClient item metadata and the Chirograph* properties are Chirograph's public surface. A code is never reused or renumbered, every code has a reference page with its own anchor, and a test checks that the reference pages list exactly the metadata, properties and codes the targets read and raise. Breaking changes follow semantic versioning.

IV. Generator telemetry stays off

Builds must not phone home. Chirograph sets KIOTA_CLI_TELEMETRY_OPTOUT=true, KIOTA_OFFLINE_ENABLED=true and DOTNET_CLI_TELEMETRY_OPTOUT=1 for every generator run, and a test pins them. Generated code stays in obj and is never committed; only a URL source's document cache may be committed.

V. Works without Dovetail

Registration is a plain IServiceCollection extension. Dovetail users get a joint through Dovetail's own DovetailTemplate extension point. Chirograph never references Dovetail.

VI. Central package management, no version drift

All NuGet package versions live in Directory.Packages.props; .csproj files never specify versions. The generator tools and the runtime packages their clients need (Microsoft.OpenApi.Kiota, Microsoft.Kiota.Bundle, Refitter, Refit.HttpClientFactory) move together as one Renovate group, and the pack writes their versions into Sdk/Packages.props. A package a consumer references itself always wins over Chirograph's implicit reference.

Development Workflow

The repository mirrors Dovetail's conventions.

Toolchain: mise install installs everything (the .NET 11 SDK, the .NET 10 runtime, node, hk and the rest, from .config/mise.toml). Run dotnet through mise.

Build: mise run build runs the ModularPipelines build in build/Build.cs: build, test, pack into artifacts/nuget, and the docs into artifacts/docs.

Test:

  • Framework: TUnit on Microsoft.Testing.Platform (not VSTest)
  • Test classes inherit LoggerTest<TestRecord> from Rocket.Surgery.Extensions.Testing.TUnit
  • Assertions: TUnit Should syntax (TUnit.Assertions.Should) · Mocks, if ever needed: TUnit.Mocks · Snapshots: Verify.TUnit
  • Run all: dotnet test
  • Run single: dotnet run --project test/Chirograph.Tests -- --treenode-filter "*/..."
  • Accept snapshots: dotnet verify accept, only after reading the diff

Lint and format: hk check and hk fix (.config/hk.pkl: dotnet format, biome, oxfmt, tombi, actionlint, xmllint and the rest). The pre-commit hook runs hk fix; CI runs it through lint.yml with autofix.ci.

Docs: mise run docs (Astro + Starlight dev server); mise run docs:build builds the site that build.yml deploys to gh-pages.

Sample: mise run sample:pack packs src/** at 0.0.0-sample, then dotnet build sample/ChirographSample/ChirographSample.slnx.

Release: GitVersion computes the version from the branch or tag; GitReleaseManager drafts releases and milestones; pushing a v* tag publishes to nuget.org with trusted publishing.

Governance

This constitution supersedes all other practices in this repository. AGENTS.md and CLAUDE.md are generated from it by APM (apm compile): amend this file, then recompile, never the generated files. Pull requests pass hk check, mise run build and the tests. Complexity must be justified.

Version: 1.1.0 | Ratified: 2026-11-15 | Last Amended: 2026-11-16

Global Instructions

Operating Modes

Use these four operating modes to shape task execution when the runtime or prompt layer needs a consistent stance.

Architect

  • Goal: recommend repository-specific structure, patterns, and trade-offs before implementation.
  • Default posture: read-only analysis with concrete assumptions called out early.
  • Preferred helpers: dotnet-architect, dotnet-aspnetcore-specialist, dotnet-cloud-specialist.
  • Output contract: lead with the recommendation, then trade-offs, target scope, and next implementation steps.

Implementer

  • Goal: deliver the smallest safe code or configuration change that satisfies the request.
  • Default posture: identify the exact target first, then edit and verify with narrow repo-native commands.
  • Preferred helpers: dotnet-architect, dotnet-aspnetcore-specialist, dotnet-testing-specialist.
  • Output contract: state the intended change first, then changed target, verification, and any remaining blockers.

Reviewer

  • Goal: produce findings-first review output focused on correctness, safety, performance, and maintainability.
  • Default posture: read-only inspection with severity ordering and evidence for every issue.
  • Preferred helpers: dotnet-code-review-agent, dotnet-security-reviewer, dotnet-performance-analyst, dotnet-testing-specialist.
  • Output contract: list findings first, include file evidence, call out missing verification, and explain the risk behind each fix.

Tester

  • Goal: define or execute the narrowest effective verification path for the affected target.
  • Default posture: prefer existing test infrastructure, deterministic checks, and scoped validation commands.
  • Preferred helpers: dotnet-testing-specialist, dotnet-code-review-agent, dotnet-performance-analyst.
  • Output contract: state the verification goal, scope, exact command or test path, and any residual coverage or flakiness risk.

Shared Directives

  • Resolve the concrete repository target before making scope claims.
  • Prefer repository conventions over generic .NET examples.
  • Escalate unresolved assumptions instead of silently inventing context.
  • Match tool usage to the mode: read-only for architect and reviewer by default; edit only when implementation or testing work requires it.

Tooling and MCP Strategy

MCP servers and fallback tooling for the dotnet-agent-harness ecosystem.

MCP Server Inventory

Server Type Primary Role Best Use Cases
serena stdio Semantic code analysis Symbol-level navigation, refactoring, dependency analysis, precise code edits
microsoftdocs-mcp http Official Microsoft documentation First-party .NET/ASP.NET/Azure docs, authoritative API references

Routing Guide

Need to navigate or refactor code?
  YES -> [mcp:serena] for symbol operations
  NO -> Continue...

Need official Microsoft documentation?
  YES -> [mcp:microsoftdocs-mcp] for .NET/Azure docs
  NO -> Continue...

Need documentation?
  Official Microsoft docs -> [mcp:microsoftdocs-mcp]
  Third-party libraries -> Web search + library READMEs
  Project-specific docs -> Read markdown files from docs/, wiki/
  GitHub operations -> Use gh CLI or web interface
  Other -> Traditional tools (Read, Grep, Glob, Bash)

Target-Specific Behaviors

Target MCP Access Notes
Claude Code Full Native MCP server support, all tools available
OpenCode Filtered Tab cycles primary agents only, @mention for subagents
Codex CLI Full All configured servers available
Copilot Jointial Uses execute tool, MCP via extensions
Gemini CLI Full Similar to Claude Code for stdio/http
Factory Droid Rules-only MCP routing through generated rules
Antigravity Portable Hooks-based, minimal surface

Health Checks

Session start validation:

  1. Verify server connectivity
  2. Report available/unavailable status
  3. Suggest fallbacks if needed

Output format:

{
  "mcpHealth": {
    "serena": { "status": "available", "type": "stdio" },
    "microsoftdocs-mcp": { "status": "available", "type": "http" }
  },
  "recommendations": []
}

Failure mitigation:

Server Down Mitigation
serena Use Read + Grep for finding code
microsoftdocs-mcp Use web search with microsoft.com/learn

Tool Categories

Category Tools Use When
Code Intelligence serena Navigation, refactoring, analysis
Documentation microsoftdocs-mcp, web search Official docs, research
GitHub gh CLI Repository operations
Traditional Read, Grep, Glob, Bash Fallback, offline scenarios

lean-ctx

Prefer lean-ctx MCP tools over native equivalents for token savings: ctx_read > Read/cat, ctx_search > Grep/rg, ctx_shell > bash, ctx_tree > ls/find. Native Edit/Write/Glob stay as-is; use ctx_edit only when Edit needs an unavailable Read. Full rules: LEAN-CTX.md (open on demand — do not auto-load).

Use the neo4j-local MCP server to query and manage the local Neo4j knowledge graph. This is a fully local graph database populated by ingesting unstructured documents via llm-graph-builder.

When to use: When the user asks about topics that may be in the knowledge base, wants to find relationships between concepts, asks to store new information, or wants to explore the graph.

Do not use: For general programming questions, library docs, or anything not likely to be in the local knowledge base.

Available MCP Tools

  • get_neo4j_schema — inspect current node labels, relationship types, and property keys
  • read_neo4j_cypher — run read-only Cypher queries (MATCH, RETURN, etc.)
  • write_neo4j_cypher — run write queries (CREATE, MERGE, SET, DELETE)

Query Patterns

Explore what's in the graph

// See all node labels and counts
CALL apoc.meta.stats() YIELD labels RETURN labels

// Browse entities of a type
MATCH (n:Entity) RETURN n LIMIT 25

// Find connections around a concept
MATCH (n)-[r]-(m)
WHERE n.id CONTAINS 'keyword' OR n.name CONTAINS 'keyword'
RETURN n, r, m LIMIT 50

Find related concepts

// Shortest path between two concepts
MATCH path = shortestPath((a)-[*..6]-(b))
WHERE a.name = 'ConceptA' AND b.name = 'ConceptB'
RETURN path

// All neighbors of a node
MATCH (n {name: 'ConceptName'})-[r]-(neighbor)
RETURN type(r), neighbor.name, neighbor

Check schema before querying

CALL apoc.meta.data()

Service Status

The knowledgebase requires these services to be running:

If MCP tools are unavailable, the services may need to be started. Inform the user rather than guessing.

Ingesting New Documents

To add new knowledge:

  1. Open http://localhost:8080 (llm-graph-builder UI)
  2. Select ollama_llama3.2 from the model dropdown
  3. Upload documents (PDF, TXT, Markdown, HTML)
  4. Click Generate Graph
  5. Use get_neo4j_schema to confirm new nodes appeared

Windows-Specific Notes

  • Ollama runs natively on Windows (not in Docker) — start with ollama serve or via system tray
  • Docker services: ./run.sh --start (or equivalent PowerShell/batch wrapper)
  • OLLAMA_BASE_URL in .env should point to http://host.docker.internal:11434

Files matching **

Use Context7 MCP to fetch current documentation whenever the user asks about a library, framework, SDK, API, CLI tool, or cloud service -- even well-known ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot. This includes API syntax, configuration, version migration, library-specific debugging, setup instructions, and CLI tool usage. Use even when you think you know the answer -- your training data may not reflect recent changes. Prefer this over web search for library docs.

Do not use for: refactoring, writing scripts from scratch, debugging business logic, code review, or general programming concepts.

Steps

  1. Always start with resolve-library-id using the library name and the user's question, unless the user provides an exact library ID in /org/project format
  2. Pick the best match (ID format: /org/project) by: exact name match, description relevance, code snippet count, source reputation (High/Medium preferred), and benchmark score (higher is better). If results don't look right, try alternate names or queries (e.g., "next.js" not "nextjs", or rephrase the question). Use version-specific IDs when the user mentions a version
  3. query-docs with the selected library ID and the user's full question (not single words)
  4. Answer using the fetched docs

Files matching tests/**

Evaluation quality review

When reviewing these files, apply the evaluation design quality bar in CONTRIBUTING.md and .agents/skills/create-skill-test/SKILL.md. For a grader, reference, or fixture change, inspect its owning eval.yaml and apply only the checks relevant to that artifact.

Leave an inline comment only for a specific, actionable defect. Check that:

  • each scenario is necessary for the target; each preference-eligible scenario adds distinct capability, risk, or customer-journey value, while dormancy and no-op guards protect a meaningful routing or preservation invariant;
  • prompts are natural developer requests and do not name the skill, reveal the answer, or prescribe its workflow;
  • deterministic graders prove the complete required result and, when scope or preservation is part of the request, cover every in-scope file;
  • golden evidence passes the deterministic contract and a realistic broken mutation would fail it;
  • rewrite scenarios include an already-correct no-op case, and routing boundaries include an uncued dormancy case that proves recognition, restraint, and redirection;
  • preference-eligible stimuli have enough task breadth for the expected tie rate, not only the five-stimulus floor;
  • fixtures reproduce only the intended condition and are complete and consistent;
  • skill evals use the Vally path, agent evals use the native SDK path, and declared time budgets are realistic;
  • broad routing or behavior claims have separate evidence across model families;
  • a proposed skill-content fix follows failure classification and is supported by the observed evidence.

Do not duplicate deterministic findings already reported by check_eval_quality.py. Do not request style-only changes. If evidence is missing, state what must be added and why the current eval could accept an incorrect result or reject a correct one.