agentleFS
rygelrygel/AIUsageTracker/CLAUDE.md

AIUsageTracker

CLAUDE.md47 starsChanged 7 months agoMITView on GitHub

Before building, kill any running app/monitor instances that lock DLLs: Run tests (capped at 4 cores per global CLAUDE.md): The following .editorconfig rules are enforced at error severity with zero violations. Never lower their severity, add suppressions, or work around them. Fix the underlying code instead. If a new violation appears, fix it before pushing. Do not: - Change severity to suggestion or none - Add #pragma warning disable - Add [SuppressMessage] attributes - Raise analyzer thresholds to make CI…

  • Reads credentials
  • Commits and pushes

The file

Show its rules and text

We split this CLAUDE.md into the rules it gives an agent

62 rules. About 0 are common, 36 are distinctive, and 26 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈36

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 26

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Before building, kill any running app/monitor instances that lock DLLs:

    line 5
  2. Distinctive:

    Run tests (capped at 4 cores per global CLAUDE.md):

    line 11
  3. Distinctive:

    If a new violation appears, fix it before pushing.

    line 31
  4. Very specific:

    After config saves/removals, MonitorService.InvalidateGroupedUsageCache() is called to prevent stale ETag responses

    line 59
  5. Distinctive:

    Only StandardApiKey providers can have their keys deleted by the user.

    line 68
  6. Very specific:

    Before creating a new doc, check docs/INDEX.md — it may already exist.

    line 74
  7. Very specific:

    After implementing any code change, check if the change affects any documentation in docs/.

    line 76
  8. Distinctive:

    When updating a doc, add or update a review header immediately below the title:

    line 78
  9. Distinctive:

    When a conversation starts — fresh window, new session, or after context compression — orient before doing anything else:

    line 89
  10. Very specific:

    If all cycle tasks are Done, suggest release or next plan.

    line 100
  11. Very specific:

    Before implementing: silently run build_execute <task_id> (start phase)

    line 109
  12. Very specific:

    After implementing: run build_execute <task_id> (complete phase) with report fields

    line 110
  13. Distinctive:

    After build_execute completes: audit the branch changes for bugs, convention violations, and doc drift (see Post-Build Audit below)

    line 111
  14. Very specific:

    After audit with findings: *MUST* automatically run review_submit with verdict request-changes and a concise summary of the audit findings …

    line 112
  15. Distinctive:

    After audit clean: present for human review — "Ready for your review — approve or request changes?"

    line 113
  16. Very specific:

    If confirmed, run strategy_change immediately.

    line 153
  17. Distinctive:

    If mid-build, finish the current task first.

    line 154
  18. Very specific:

    After every build_execute (complete), audit the branch before presenting for human review.

    line 199
  19. Very specific:

    Identify changed files: Run git diff origin/main --name-only to find modified files.

    line 201
  20. Very specific:

    Documentation check: If any docs/ files describe behaviour that the change modified, flag as "Doc drift".

    line 207
  21. Very specific:

    If findings exist: Run review_submit with request-changes and the findings.

    line 209
  22. Distinctive:

    Start a fresh window when:

    line 214
  23. Distinctive:

    Rule of thumb: If you've been in the same window for 30+ minutes or 3+ tasks, it's time for a fresh one.

    line 225
  24. Distinctive:

    In Review tasks with no PR: If branch is already merged to main, the review_submit step was missed.

    line 231
  25. Distinctive:

    When the system compresses prior messages, immediately:

    line 243
  26. Distinctive:

    Check your todo list for in-progress work

    line 245
  27. Very specific:

    Dependent tasks (any size): When a task's BUILD HANDOFF lists a DEPENDS ON task from the same cycle, build_execute automatically reuses the …

    line 254
  28. Very specific:

    Do NOT read .papi/ files for context — use MCP tools.

    line 267
  29. Very specific:

    board_edit never updates the cycle field: When moving a task into or out of a cycle, always run a SQL update alongside board_edit:

    line 269
  30. Distinctive:

    Do NOT rely on memory, prior conversation, or inference.

    line 283
  31. Distinctive:

    If the answer requires checking 2-3 files, check them all before responding.

    line 284
  32. Distinctive:

    Preview frontend changes: After any UI/styling build, provide the localhost URL so the user can visually review.

    line 292
  33. Distinctive:

    Debug one change at a time: When fixing issues, make one change, verify it, then move on.

    line 293
  34. Distinctive:

    Test the write-read roundtrip: Every data write path must have a verified read path.

    line 294
  35. Distinctive:

    Test after every build: Run the project's test suite after implementing.

    line 295
  36. Distinctive:

    Use this — combined with the published tags — to derive the next version.

    line 305
  37. Distinctive:

    Audit before widening access: Before any build that adds endpoints, modifies auth/RLS, introduces new user types, or changes access …

    line 310
  38. Very specific:

    Flag access-widening changes: If a build touches auth, RLS policies, API keys, or user-facing access, note "Security surface reviewed" in …

    line 311
  39. Very specific:

    Never ship secrets: Do not commit .env files, API keys, or credentials.

    line 312
  40. Very specific:

    Only build tasks assigned to the current cycle: Use build_list — it filters to current-cycle tasks with handoffs.

    line 318
  41. Distinctive:

    Don't ask premature questions: If the project is in early cycles, don't ask about deployment accounts, hosting providers, OAuth setup, or …

    line 319
  42. Distinctive:

    Split large ideas: If an idea has 3+ concerns, submit it as 2-3 separate ideas so the planner creates properly scoped tasks — not …

    line 320
  43. Very specific:

    Auto-release completed cycles: When all cycle tasks are Done and reviews accepted, run release immediately.

    line 321
  44. Distinctive:

    Show task names, not just IDs: When summarising board state or reconciliation, include task names — e.g.

    line 324
  45. Distinctive:

    Surface the next command: After each step, tell the user what comes next.

    line 325
  46. Distinctive:

    Access-widening stages require auth/security phases: Before declaring a stage complete, check if it widens who can access the product (e.g.

    line 328
  47. Distinctive:

    Test both success and failure paths

    line 352
  48. Distinctive:

    Never use silent catch blocks — always log with context

    line 357
  49. Very specific:

    Use _logger.LogError(ex, "message") for unexpected errors

    line 358
  50. Distinctive:

    Never throw in async void methods — use async Task

    line 360
  51. Distinctive:

    Never duplicate provider metadata into DB tables

    line 364
  52. Distinctive:

    Never delete customer data automatically — filter placeholder data at the source before storing

    line 366
  53. Very specific:

    After each release, append a dogfood entry capturing observations from the cycle.

    line 370
  54. Distinctive:

    Call the adapter method with structured entries for each observation:

    line 371
  55. Distinctive:

    After all tasks built, batch review them together

    line 387
  56. Very specific:

    Run build_list to see every task assigned to the current cycle.

    line 393
  57. Distinctive:

    Read the BUILD HANDOFFs together — not one at a time.

    line 394
  58. Very specific:

    Only then run build_execute on the first task.

    line 399
  59. Distinctive:

    Every 5 cycles, PAPI offers a strategy review — a deep analysis of velocity, estimation accuracy, active decisions, and project direction.

    line 405
  60. Very specific:

    If the review recommends AD changes, use strategy_change to apply them.

    line 410
  61. Very specific:

    Check ADs before making architectural choices — run health for the AD summary.

    line 416
  62. Very specific:

    When new evidence appears, update AD confidence via strategy_change.

    line 418

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

Build & Test

Before building, kill any running app/monitor instances that lock DLLs:

pwsh -File scripts/kill-all.ps1

Run tests (capped at 4 cores per global CLAUDE.md):

dotnet test AIUsageTracker.Tests/AIUsageTracker.Tests.csproj -T 4

Analyzer Rules — Do Not Weaken

The following .editorconfig rules are enforced at error severity with zero violations. Never lower their severity, add suppressions, or work around them. Fix the underlying code instead.

RuleSeverityWhat it enforces
CA1031warningNo catching general Exception — use specific types
CA1062errorValidate public method parameters for null
CA1307errorExplicit StringComparison on all string operations
CA2016errorForward CancellationToken to async methods
CA2254errorUse structured logging templates, not interpolation

If a new violation appears, fix it before pushing. Do not:

  • Change severity to suggestion or none
  • Add #pragma warning disable
  • Add [SuppressMessage] attributes
  • Raise analyzer thresholds to make CI pass

Architecture

  • AIUsageTracker.UI.Slim — WPF main window + settings dialog (net10.0-windows)
  • AIUsageTracker.Monitor — Background agent that polls providers and serves usage data over HTTP
  • AIUsageTracker.Core — Shared models, interfaces, monitor client
  • AIUsageTracker.Infrastructure — Provider implementations (Synthetic, Codex, OpenAI, etc.)

Data flow: Monitor → Main Window

  1. Monitor polls each configured provider via IProvider.GetUsageAsync(config)
  2. Results are grouped into AgentGroupedUsageSnapshot and served via HTTP with ETag caching
  3. Main window polls MonitorService.GetGroupedUsageAsync() every 2-60 seconds
  4. GroupedUsageDisplayAdapter.Expand() flattens the snapshot into List<ProviderUsage>
  5. MainWindowRuntimeLogic.PrepareForMainWindow() filters by visibility and state
  6. RenderProviders() builds the card UI

Settings dialog interaction

  • Settings loads its own copy of _configs and _usages from the monitor
  • Config changes are auto-saved with 600ms debounce via PersistAllSettingsAsync
  • Settings always shows all default providers (ShowInSettings=true) as configuration slots
  • On close, DialogResult = true triggers main window to call InitializeAsync() which re-fetches everything
  • After config saves/removals, MonitorService.InvalidateGroupedUsageCache() is called to prevent stale ETag responses

Provider settings modes

  • StandardApiKey — User-editable API key field (Synthetic, Mistral, Kimi, etc.)
  • SessionAuthStatus — Session-based auth with status display (Codex, OpenAI)
  • AutoDetectedStatus — Auto-discovered, read-only (Antigravity, OpenCode Zen)
  • ExternalAuthStatus — External auth flow (GitHub Copilot)

Only StandardApiKey providers can have their keys deleted by the user.

Documentation Maintenance

Before creating a new doc, check docs/INDEX.md — it may already exist. When creating or archiving docs, update the index.

After implementing any code change, check if the change affects any documentation in docs/. If a doc describes behaviour, architecture, or file interactions that your change modified, update the doc to stay accurate.

When updating a doc, add or update a review header immediately below the title:

# Document Title
> Last reviewed: task-NNN — DD-MM-YYYY

Replace task-NNN with the task ID that triggered the update, and DD-MM-YYYY with today's date.

Session Start

When a conversation starts — fresh window, new session, or after context compression — orient before doing anything else:

  1. Run orient — single call that returns cycle number, task counts, in-progress/in-review tasks, strategy review cadence, trends, and recommended next action.
  2. Fix orphaned tasks silently — check for feat/task-XXX branches that don't match board status. Fix and report after.
  3. Summarise: "You're on Cycle N. X tasks to build, Y builds pending review." or "Cycle N is complete — ready for the next plan."
  4. Run build_list when picking a task — orient shows counts only. build_list shows the full task list with handoffs.

CRITICAL: Check task statuses before acting.

  • In Review = already built. Suggest review_list → review_submit. NEVER re-build an In Review task.
  • In Progress = build started but not completed. Check the branch and existing changes before writing new code.
  • Backlog = not started. But first check if a feat/task-XXX branch already exists with commits — fix it, don't rebuild.
  • If all cycle tasks are Done, suggest release or next plan.

Workflow Sequences

PAPI tools follow structured flows. The agent manages the cycle workflow automatically — the user should never need to type tool names or remember the flow. Handle the plumbing, surface the summaries.

Cycle Workflow (auto-managed)

  • Run tools automatically — don't ask the user to invoke MCP tools manually
  • Before implementing: silently run build_execute <task_id> (start phase)
  • After implementing: run build_execute <task_id> (complete phase) with report fields
  • After build_execute completes: audit the branch changes for bugs, convention violations, and doc drift (see Post-Build Audit below)
  • After audit with findings: MUST automatically run review_submit with verdict request-changes and a concise summary of the audit findings as the changes requested — the builder fixes these before the task goes to human review
  • After audit clean: present for human review — "Ready for your review — approve or request changes?"
  • User approves/requests changes → run review_submit behind the scenes

The Cycle (main flow)

plan → build_list → build_execute → audit → review_list → review_submit → build_list
  1. plan — Run at the start of each cycle to generate the cycle plan and populate the board. Next: build_list to see prioritised tasks.
  2. build_list — View tasks ready for execution, ordered by priority. Next: build_execute <task_id> to start a task.
  3. build_execute (start) — Creates a feature branch and marks the task In Progress. Returns the build handoff. Next: Implement the task, then build_execute <task_id> again with report fields to complete.
  4. build_execute (complete) — Submits the build report, commits, and marks the task In Review. Next: Run the post-build audit automatically.
  5. Post-build audit — Review branch changes for bugs, convention violations, and doc drift (see Post-Build Audit section below). Next: If findings exist, run review_submit with request-changes and the audit findings. If clean, proceed to review_list.
  6. review_list — Shows tasks pending human review (handoff-review or build-acceptance). Next: review_submit to approve, accept, or request changes.
  7. review_submit — Records the review verdict and updates task status. Next: build_list to view next build

Strategy Review

strategy_review → strategy_change
  • strategy_review — Analyses project health, velocity, and estimation accuracy. Next: strategy_change if the review recommends adjustments.
  • strategy_change — Updates active decisions, north star, or project direction based on review findings.

Detect Strategic Decisions in Conversation

Watch for: direction changes, architecture shifts, deprioritisation with reasoning, new principles, competitive positioning decisions.

When detected:

  1. Flag it: "That sounds like a strategic direction change — should I run strategy_change?"
  2. If confirmed, run strategy_change immediately.
  3. If mid-build, finish the current task first.

Idea Capture

idea → (picked up by next plan)
  • idea — Captures a new task idea and writes it to the backlog. Next: The next plan run will prioritise and schedule it.

Project Bootstrap

setup → plan
  • setup — Initialises the project in the database and scaffolds config files. Next: plan to run the first cycle planning session.

Board Management

  • board_view — Read-only view of all tasks on the board.
  • board_archive — Removes completed/cancelled tasks from the board to an archive.
  • board_deprioritise — Moves a task to a later phase.

Quick Reference: Tool → Next Step

ToolNext Step
setupplan
planbuild_list
build_listbuild_execute <task_id>
build_execute (start)Implement, then build_execute (complete)
build_execute (complete)Post-build audit (automatic)
Audit (findings)review_submit with request-changes
Audit (clean)review_list
review_listreview_submit
review_submit (approve/accept)build_list
review_submit (request-changes)build_execute (redo) or build_list
strategy_reviewstrategy_change (if needed)
ideaNext plan picks it up

Post-Build Audit

After every build_execute (complete), audit the branch before presenting for human review. This catches bugs and convention violations early.

  1. Identify changed files: Run git diff origin/main --name-only to find modified files. If no changes, report "No changes to audit" and skip.
  2. Review each changed file for:
    • Logic errors, off-by-one mistakes, incorrect conditions
    • Unhandled edge cases (null, undefined, empty inputs)
    • Convention violations defined in this CLAUDE.md
    • Incorrect type narrowing or unsafe casts
  3. Documentation check: If any docs/ files describe behaviour that the change modified, flag as "Doc drift".
  4. Report: For each issue: file path, severity (Bug/Convention/Doc drift), what's wrong, how to fix.
  5. If findings exist: Run review_submit with request-changes and the findings. Fix before human review.
  6. If clean: Present for human review — "Ready for your review — approve or request changes?"

When to Start a New Conversation

Start a fresh window when:

  • After a release — cycle is done, context is heavy. New window orients in seconds via orient.
  • After 3+ tasks built — accumulated file reads, diffs, and discussions bloat context. Quality degrades.
  • Switching modes — going from building to planning, or from strategy review to building. Each mode benefits from clean context.
  • After context compression fires — if you notice earlier messages are missing, the window is getting stale. Open fresh.

Stay in the same window when:

  • Building sequential tasks in a batch (especially XS/S tasks)
  • Mid-task and not yet complete
  • Having a strategic discussion that informs the next action

Rule of thumb: If you've been in the same window for 30+ minutes or 3+ tasks, it's time for a fresh one.

Housekeeping — Fix Orphaned Tasks

On session start, silently check for and fix:

  1. Orphaned branches: git branch | grep feat/task — cross-reference with board status. Fix by merging or flagging.
  2. In Review tasks with no PR: If branch is already merged to main, the review_submit step was missed.
  3. Stale In Progress: Branch has no recent commits — flag it.
  4. Config mismatches: .mcp.json has DATABASE_URL but PAPI_ADAPTER is still md — flag it.

Do this automatically and silently. Report what you found and fixed.

Plumbing Is Autonomous

Board status updates, branch cleanup, orphaned task fixes, commit/PR/merge for housekeeping — these are mechanical plumbing. Do them end-to-end without stopping to ask. Report after the fact.

Context Compression Recovery

When the system compresses prior messages, immediately:

  1. Run orient — single call for cycle state
  2. Check your todo list for in-progress work
  3. Run housekeeping checks
  4. NEVER re-build a task that is already In Review or Done.
  5. Continue where you left off — don't restart or re-plan

Branching & PR Convention

  • XS/S tasks in the same cycle and module: Group on shared branch. One PR, one merge.
  • M/L tasks or different modules: Own branch per task. Isolated PRs.
  • Dependent tasks (any size): When a task's BUILD HANDOFF lists a DEPENDS ON task from the same cycle, build_execute automatically reuses the upstream task's branch so commits stack for a single PR. Do not create a separate branch manually.
  • Commit per task within grouped branches — traceable git history.
  • Never use build_execute with light=true on shared branches. Light mode commits directly to the current branch without creating a PR. When a shared branch is squash-merged, those commits are collapsed — any CLAUDE.md or documentation changes are stripped. Use light mode only on isolated single-task branches where no squash-merge will occur.

Quick Work vs PAPI Work

PAPI is for planned work. Quick fixes — just do them. No need for plan or build_execute.

After completing quick/ad-hoc work (bug fixes, config changes, small improvements done outside the cycle), call ad_hoc to record it. This creates a Done task + build report so the work appears in cycle history and metrics. Don't skip this — unrecorded work is invisible work.

Data Integrity

  • Use MCP tools for all project data operations. DB is the source of truth when using the pg adapter.
  • Do NOT read .papi/ files for context — use MCP tools.
  • .papi/ files may be stale when using pg adapter. This is expected.
  • board_edit never updates the cycle field. When moving a task into or out of a cycle, always run a SQL update alongside board_edit:
    • Adding to current cycle: UPDATE cycle_tasks SET cycle = <N> WHERE display_id = '<task-id>';
    • Removing from cycle (backlog): UPDATE cycle_tasks SET cycle = null WHERE display_id = '<task-id>';

Code Before Claims — No Assumptions

Before making any claim about how the codebase works, read the relevant file first.

This includes:

  • How a feature is implemented ("it works like X") → read the source
  • Whether something exists ("there's no baseline migration") → check the directory
  • Whether a flow is broken or working → trace it in code
  • What a user would experience → check the actual page/component

Do NOT rely on memory, prior conversation, or inference. Read first, then answer. If the answer requires checking 2-3 files, check them all before responding.

Process Rules

These rules come from 80+ cycles of dogfooding. They prevent the most common sources of wasted time and rework.

Building

  • Verify before claiming done. Hit the endpoint, check the rendered output, confirm the data round-trips. Never say "should work" — prove it works.
  • Preview frontend changes. After any UI/styling build, provide the localhost URL so the user can visually review. Don't make them ask for it.
  • Debug one change at a time. When fixing issues, make one change, verify it, then move on. Don't stack multiple untested fixes.
  • Test the write-read roundtrip. Every data write path must have a verified read path. If you write to DB, confirm the read query returns what was written. This is the #1 source of silent failures.
  • Test after every build. Run the project's test suite after implementing. Suggest follow-up tasks from learnings when meaningful.
  • Build patiently. Validate each phase against the last. Don't rush through implementation — test through the UI, not just the API.

Release Versioning — Never Reuse, Always Bump

  • NEVER overwrite an existing tag like vX.Y.Z-beta.N with new (potentially broken) code. The user's auto-updater and any installed copy are pinned to that tag — re-tagging makes the auto-updater silently overwrite a working install with broken code, or fails to detect a new release.
  • Before tagging a release, run git tag -l "vX.Y.Z*" and gh release list --limit 5 to see what already exists. If the tag you're about to push matches an existing one, bump the version (e.g. -beta.N → -beta.N+1) instead of force-overwriting.
  • Before deciding the version number, check the installed app's actual product version on disk:
    (Get-Item "C:\Users\Alexander\AppData\Local\Programs\AIUsageTracker\AIUsageTracker.exe").VersionInfo.ProductVersion
    Use this — combined with the published tags — to derive the next version.
  • When the user already has v2.4.X-beta.N installed (broken or not), the next fix MUST be v2.4.X-beta.N+1. Re-tagging the same beta is wrong because the auto-updater will not offer an "upgrade" to the same string.
  • If you tagged the wrong release, the recovery is git tag -d <tag> + git push origin :refs/tags/<tag> + gh release delete <tag> -y, then build a fresh tag with a bumped -beta.N+1. Don't try to reuse or overwrite tags — git's repo rules will block the latter anyway.

Security

  • Audit before widening access. Before any build that adds endpoints, modifies auth/RLS, introduces new user types, or changes access controls — review the security implications first. Fix findings before shipping.
  • Flag access-widening changes. If a build touches auth, RLS policies, API keys, or user-facing access, note "Security surface reviewed" in the build report's discovered_issues or architecture_notes.
  • Never ship secrets. Do not commit .env files, API keys, or credentials. Check .gitignore covers sensitive files before pushing.
  • Telemetry opt-out. PAPI collects anonymous usage data (tool name, duration, project ID). To disable, add "PAPI_TELEMETRY": "off" to the env block in your .mcp.json.

Planning & Scope

  • NEVER run plan more than once per cycle. Adjust the cycle with board_deprioritise or idea instead.
  • NEVER skip cycles. Complete and release the current cycle before running the next plan.
  • Only build tasks assigned to the current cycle. Use build_list — it filters to current-cycle tasks with handoffs.
  • Don't ask premature questions. If the project is in early cycles, don't ask about deployment accounts, hosting providers, OAuth setup, or commercial features. Focus on building core functionality first.
  • Split large ideas. If an idea has 3+ concerns, submit it as 2-3 separate ideas so the planner creates properly scoped tasks — not kitchen-sink handoffs.
  • Auto-release completed cycles. When all cycle tasks are Done and reviews accepted, run release immediately. Forgetting causes cycle number drift and merge conflicts in the next session.

Communication

  • Show task names, not just IDs. When summarising board state or reconciliation, include task names — e.g. "task-42: Add supplier form" not just "task-42".
  • Surface the next command. After each step, tell the user what comes next. Commands should be surfaced, not memorised.

Stage Readiness

  • Access-widening stages require auth/security phases. Before declaring a stage complete, check if it widens who can access the product (e.g. Alpha Distribution, Alpha Cohort). If so, auth hardening and security review must be completed first — not discovered after the fact.
  • Pattern: Audit access surface → fix vulnerabilities → then widen access. Never ship access-widening without a security phase.

PAPI Project Conventions

Build & Test Commands

  • Build: dotnet build AIUsageTracker.sln --configuration Debug
  • Test: dotnet test AIUsageTracker.Tests/AIUsageTracker.Tests.csproj --configuration Debug
  • Pre-commit validation: ./scripts/pre-commit-check.sh
  • Publish: .\scripts\publish-app.ps1 -Runtime win-x64

Code Style Conventions

  • File-scoped namespaces: namespace AIUsageTracker.Core.Models;
  • Allman-style braces (opening brace on new line)
  • 4-space indentation, no tabs
  • Private fields: _camelCase with underscore prefix
  • PascalCase for classes, methods, properties
  • Async methods end with Async suffix
  • Nullable reference types enabled globally — always handle potential nulls

Testing Conventions

  • xUnit with Moq for mocking
  • Arrange-Act-Assert pattern
  • Descriptive test names: MethodName_Scenario_ExpectedBehavior
  • Test both success and failure paths
  • Provider fixtures must be based on real provider responses (sanitized), not invented values
  • UI startup tests must verify no deadlocks in async loading

Error Handling

  • Never use silent catch blocks — always log with context
  • Use _logger.LogError(ex, "message") for unexpected errors
  • Return error state objects for provider failures rather than throwing
  • Never throw in async void methods — use async Task

Architecture Conventions

  • Database stores raw values only — ProviderDefinition classes are the authority for interpretation
  • Never duplicate provider metadata into DB tables
  • Serve cached data immediately on startup; only refresh system providers (no external API hammering)
  • Never delete customer data automatically — filter placeholder data at the source before storing

Dogfood Logging

After each release, append a dogfood entry capturing observations from the cycle. Call the adapter method with structured entries for each observation:

  • friction — workflow pain points, confusing flows, things that broke or slowed you down
  • methodology — what worked or didn't in the plan/build/review cycle
  • signal — indicators of product-market fit, user value, or growth potential
  • commercial — cost, pricing, or business model observations

This is autonomous plumbing — log observations after release without asking.

<!-- PAPI_ENRICHMENT_TIER_1 -->

Batch Building (unlocked at cycle 6)

For cycles with multiple tasks, batch build them without stopping between each:

  • Build XS/S tasks first, then M/L — same-module tasks land on the cycle branch automatically regardless of size
  • One commit per task for traceable history on the shared cycle branch
  • After all tasks built, batch review them together

Gestalt Pre-Build Check (multi-task cycles)

Before build_execute on the first task of any multi-task cycle, read the cycle as a whole:

  1. Run build_list to see every task assigned to the current cycle.
  2. Read the BUILD HANDOFFs together — not one at a time. Look for:
    • Shared files across handoffs — the same path in two FILES LIKELY TOUCHED lists usually means a refactor opportunity, a shared helper to extract first, or a sequencing constraint.
    • Shared modules — multiple tasks in the same module should land on a shared cycle branch (feat/cycle-N-<module>) so they merge together.
    • Design decisions implicit across tasks — e.g. one task introduces a new field, a later task consumes it. Build the producer first.
    • Module split — tasks in different modules will land on different cycle branches (feat/cycle-N-<module>) and merge separately. Flag any cross-module coordination required before kicking off.
  3. Only then run build_execute on the first task.

This is a one-time check at the start of the cycle, not per-task. It catches scope conflicts, redundant work, and ordering hazards that an isolated handoff read can't see. Skip it for single-task cycles.

Strategy Reviews

Every 5 cycles, PAPI offers a strategy review — a deep analysis of velocity, estimation accuracy, active decisions, and project direction.

  • Don't skip them. They're where compounding value comes from.
  • Strategy reviews run in their own session — don't mix with building.
  • Reviews produce recommendations that feed into the next plan.
  • If the review recommends AD changes, use strategy_change to apply them.

Active Decision Lifecycle

Active Decisions (ADs) track architectural and product choices with confidence levels (LOW → MEDIUM → HIGH).

  • Check ADs before making architectural choices — run health for the AD summary.
  • ADs are for product/architecture choices only, not process preferences.
  • When new evidence appears, update AD confidence via strategy_change.
  • Supersede rather than overwrite — old decisions stay as history.
  • New ADs should include a ### Reversal Trigger section: specify the signal that would invalidate the stance, the action to take (modify/supersede/abandon), and why writing it now prevents sunk-cost drift later.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.