Skip to content

docs(agents): consolidate AGENTS.md guidance into skills and rules#4355

Open
pandemicsyn wants to merge 5 commits into
mainfrom
docs/agents-md-consolidation
Open

docs(agents): consolidate AGENTS.md guidance into skills and rules#4355
pandemicsyn wants to merge 5 commits into
mainfrom
docs/agents-md-consolidation

Conversation

@pandemicsyn

@pandemicsyn pandemicsyn commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Clean up

Key moves:

  • Cloudflare Worker/DO conventions duplicated across services consolidated into the repo-local durable-objects skill (references/repo-conventions.md): DO call retries (withDORetry), DO stub helpers, sub-module splitting, IO boundaries, DB clients. The module-scope DB-client-caching rule moved into workers-best-practices.
  • Coding standards consolidated into existing and kinda duplicated .kilo/rules/coding-style.md (reconciling the as-operator rule to the nuanced version); per-package restatements removed. Stale .kilocode/rules/... path fixed.
  • GDPR/PII deduped (kept once in .kilo/rules/gdpr-pii.md). Theres also a pre-existing ci check.
  • PR conventions moved into a /cloud-pr command. We already had one a pr slash command at some point and I'm guessing most folks have their own workflow.
  • Spec index moved into a new specs skill (rebuilt from disk — all .specs/ except template.md); per-service spec pointers added to kiloclaw, kiloclaw-billing, mcp-gateway.
  • Domain Context rescoped to state CONTEXT.md covers only the Code Reviewer + Security Agent domains.
  • CI-enforced Markdown Tables prose removed from root AGENTS.md.
  • Plus some additional trimming like the .plans instruction.

Root AGENTS.md shrank from 134 to ~75 lines.

Verification

Visual Changes

N/A

Reviewer Notes

Reduce always-loaded agent context by moving conditionally-relevant and
duplicated guidance out of AGENTS.md files into the mechanisms that load
on demand or by reference.

- Move duplicated Cloudflare Worker/DO conventions (file naming, DO stub
  helpers, sub-module splitting, IO boundaries, SQL, HTTP routes, withDORetry)
  into a shared durable-objects skill reference; trim gastown/wasteland/
  mcp-gateway/cloud-agent-next AGENTS.md to pointers + genuine deltas.
- Move the module-scope DB-client-caching rule into workers-best-practices
  skill; drop the Workers & Durable Objects section from root AGENTS.md.
- Consolidate coding standards into .kilo/rules/coding-style.md (reconciling
  the `as`-operator rule to the nuanced version); remove restatements from
  root, extension, mobile, and kiloclaw AGENTS.md. Fix stale .kilocode path.
- Dedup GDPR/PII rule (kept in .kilo/rules/gdpr-pii.md).
- Move PR conventions into a /cloud-pr command.
- Move the spec index into a specs skill (rebuilt from disk, all specs
  except template.md); add per-service spec pointers to kiloclaw,
  kiloclaw-billing, and mcp-gateway.
- Delete the CI-enforced Markdown Tables prose.
- Rescope the Domain Context section to state CONTEXT.md covers only the
  Code Reviewer and Security Agent domains.
…self-contained

Follow-up to the consolidation: the shared durable-objects repo-conventions doc
had over-generalized Gastown/Wasteland-specific patterns.

- Trim repo-conventions.md to genuinely shared Worker/DO conventions (DO call
  retries, DO stub helper, sub-modules, IO boundaries, DB clients); drop the
  SQL/table and HTTP-route sections that are not universal.
- Revert services/gastown/AGENTS.md and services/wasteland/AGENTS.md to their
  original main content (they keep their own raw-query() SQL conventions rather
  than pointing at a shared doc).
- mcp-gateway: HTTP routes section lists only its own route surface.
- Update durable-objects SKILL.md description to match repo-conventions.md.
@pandemicsyn pandemicsyn marked this pull request as ready for review July 1, 2026 22:03
Comment thread AGENTS.md
Comment on lines +24 to +26
`CONTEXT.md` is the domain-language and ownership contract for the **Code Reviewer** and **Security Agent** domains only (review execution/analytics, Security Findings, Security Sync, notifications, remediation, and their email delivery — mainly `apps/web/src/lib/{code-reviews,security-agent}/`, `services/security-sync/`). It does not cover other areas of the monorepo.

When working in those domains, read `CONTEXT.md` first and use its canonical terms in code, docs, task descriptions, tests, and agent outputs. Do not introduce synonyms for its concepts without updating `CONTEXT.md` first, and do not duplicate the full contract inside `AGENTS.md`.

@pandemicsyn pandemicsyn Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Previously its seems like we instructed the agent to load this all the time. But this doc actually seems like it only applies to Code/Security reviewer. I'm guessing because the agent confuses the terminology used by the two?

This might work better as a skill or something? But hopefully this cuts down on eager loading.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is an artifact of the /grill-with-docs skill.
It think it has long-term value, but it needs to be back-filled with context about the rest of the repo.
We might also want to consider whether we want this to live separately in each app/service/package and maybe just have a context map at the root of the repo?

routes in v1.

## File naming
## Specs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: Conventions dropped for this service with no replacement

This removes mcp-gateway's own "File naming" section, and (further down in this same file's diff) the "table interpolator objects / no raw table or column strings" SQL-safety rule and the "gateway is stricter than Gastown" IO-boundary detail — on the assumption these are now covered by the shared durable-objects skill (references/repo-conventions.md). However, this PR's later commit also removes the "File naming", "Column naming", "SQL queries", and "HTTP routes" sections from repo-conventions.md. services/gastown/AGENTS.md and services/wasteland/AGENTS.md are unaffected by this PR (net-zero diff) and still carry those conventions verbatim, but mcp-gateway now has none of them documented anywhere — including the no-table-aliasing/no-raw-string SQL-safety rules and the no-Hono-sub-app-mounting HTTP rule.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

- Never use `as` to cast IO data. If the shape is known, define a Zod schema; if
not, use `.passthrough()` or a catch-all schema.

## DB clients

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: File naming/Column naming/SQL queries/HTTP routes sections removed with no home

This deletes the "File naming", "Column naming", "SQL queries" (table-interpolator, no-table-aliasing, Zod row-parsing rules), and "HTTP routes" (no Hono sub-app mounting) sections that an earlier commit in this same PR pointed to as the shared home for these conventions (see this file's own earlier wording and services/mcp-gateway/AGENTS.md's removed "File naming" section, which now assumes this file covers it). services/gastown/AGENTS.md and services/wasteland/AGENTS.md are untouched by this PR and still carry these conventions directly, but services/mcp-gateway/AGENTS.md removed its own copies expecting this file to retain them — leaving those rules (notably the SQL table-aliasing/raw-string guardrails) undocumented for mcp-gateway.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

The consolidation drops several DO/service conventions (file naming, SQL query safety rules, HTTP-routing rules) from both the shared durable-objects skill and services/mcp-gateway/AGENTS.md without leaving them documented anywhere, since services/gastown and services/wasteland end up with no net change in this PR and keep their own copies.

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
services/mcp-gateway/AGENTS.md 16 Removes its own File naming/SQL-safety/IO-boundary conventions assuming they live in repo-conventions.md, but that file also drops them in this PR
.agents/skills/durable-objects/references/repo-conventions.md 78 Removes File naming, Column naming, SQL queries, and HTTP routes sections with no other home; mcp-gateway relied on this file retaining them
Files Reviewed (14 files)
  • .agents/skills/durable-objects/SKILL.md
  • .agents/skills/durable-objects/references/repo-conventions.md - 1 issue
  • .agents/skills/specs/SKILL.md
  • .agents/skills/workers-best-practices/SKILL.md
  • .agents/skills/workers-best-practices/references/rules.md
  • .kilo/command/cloud-pr.md
  • .kilo/rules/coding-style.md
  • AGENTS.md
  • apps/extension/AGENTS.md
  • apps/mobile/AGENTS.md
  • services/cloud-agent-next/AGENTS.md
  • services/kiloclaw-billing/AGENTS.md
  • services/kiloclaw/AGENTS.md
  • services/mcp-gateway/AGENTS.md - 1 issue

Note: services/gastown/AGENTS.md and services/wasteland/AGENTS.md show hunks in the raw multi-commit diff but net to zero change vs. the PR base (confirmed via blob hashes), so they are outside this PR's actual scope and were not commented on.

Incremental update: since the previous review (commit 89d2d2b7), only .agents/skills/specs/SKILL.md and services/kiloclaw-billing/AGENTS.md changed. Both changes adopt the human reviewer's previously suggested wording (softening the specs skill from mandatory/authoritative to contextual, and pointing to loading the specs skill rather than reading files directly) and introduce no new issues. The two WARNING findings above are unaffected by this increment and remain outstanding.

Fix these issues in Kilo Cloud

@@ -0,0 +1,84 @@
# Repo Conventions — Worker/DO Services in This Monorepo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment/question, not review feedback:

Something I ran into in the on-call repo was the split between where we put custom-authored skills and 3rd party skills, and does it even matter. For instance we tend to use npx skills as our "skill package manager" for 3rd party skills and install that into .agents/skills as its mostly supported across all agents.

In the on-call repo we had a mixture of custom and 3rd party skills and ended up with:

- .agents/skills → 3rd party skills
- .kilo/skills → custom skills

It feels duplicative though to have skills in two places and maybe we should just put it all in .agents/skills like it seems we're going for in this repo.

No strong opinions, just think it would be good to be consistent across all repos so we don't have to think about it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i actually struggled with this more broadly as well - because i also have the actual official cloudflare skill + cloudflare mcp set up globally.

I'm down for copying the setup in the on-call repo.

- `./references/rules.md` - Core rules, storage, concurrency, RPC, alarms
- `./references/testing.md` - Vitest setup, unit/integration tests, alarm testing
- `./references/workers.md` - Workers handlers, types, wrangler config, observability
- `./references/repo-conventions.md` - This repo's Worker/DO conventions: DO call

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok this is actual review feedback and here's where we should make a decision on how we want to handle 3rd party vs custom skills.

If we want to use npx skills as our "skill package manager" to easily be able to update skills to their latest version, then I think we should withhold from making any changes to those skills like we are doing here.

An alternative: No 3rd party skills in repo by default

  • We could have a recommended list of skills that might be useful but require the user to install it separately.
  • This puts extra burden on the developer to make sure they have the right "tools" in place when working on the repo, but one could argue that's how we've done things in the past with which IDE you use, etc.

@marius-kilocode might have some thoughts on this as I believe he favors a more bare repo with limited agent pre-configuration to allow for more flexibility in personal development workflows and control.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mentioned this above as well but:

i actually struggled with this more broadly as well - because i also have the actual official cloudflare skill + cloudflare mcp set up globally.

I'd be up for this. I already have my own review agents, pr skills, etc. So this doesn't feel un-natural.

Some of these custom additions for Cloudflare specifically could also go in REVIEWS.md. e.g. insisting on withDORetry

Comment thread .agents/skills/specs/SKILL.md Outdated
Comment thread .agents/skills/specs/SKILL.md Outdated
Comment thread .kilo/command/cloud-pr.md
@@ -0,0 +1,30 @@
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we might be good to delete this command. I imagine most folks have their own workflow for this and the repo template serves as a guide for external contributors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

Comment thread services/kiloclaw-billing/AGENTS.md Outdated

@RSO RSO left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is an improvement. I do want to second some of @jeanduplessis's comments regarding the wording of the specs. If we tell the bot that the specs are the authoritative source of truth, it will be reluctant to suggest a change when my prompt conflicts with a spec. Usually, when this happens, the bot will twist itself into all kinds of weird corners to somehow figure out how to comply with my prompt while keeping the spec as is.

Personally, I'd much rather have the bot just make a change to the spec file when this happens, because that makes it very clear to me that what I'm asking conflicts with something we decided earlier. It also fits much more with our iterative approach to software development, as opposed to the waterfall-y approach of treating specs as set-in-stone.

pandemicsyn and others added 3 commits July 2, 2026 08:12
Co-authored-by: Jean du Plessis <jeandp@gmail.com>
Co-authored-by: Jean du Plessis <jeandp@gmail.com>
Co-authored-by: Jean du Plessis <jeandp@gmail.com>
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.

3 participants