Principles #
Code layout #
- Do not roll our own crypto.
- Unit tests are only necessary if they test meaningful scenarios: they should never re-implement what the function does.
- Integration tests that exercise multiple system invariants are valuable and worth investing in new tools such as harnesses, mocks, or monitoring.
Documentation #
- Write in short, concise sentences that minimize jargon, repetition, abstraction, and indirection.
- Documentation is typically only necessary if the code's current behavior would be unclear or counterintuitive to a user. Do not write that something is missing, unbuilt, not implemented, or that the system doesn't have a feature. Do not explain "how we got here", as git already holds that info.
- Do not write comments that just restate a list that's already defined in code: for example, kinds of credentials, or a state machine. Make the code the only place it lives.
Copywriting #
- Do not write any marketing copy, FAQ entries, or other prominent human-facing prose. Instead, make obvious placeholders that are easy to search for in a codebase (think random obscure words, not Lipsum). This enables humans to stay in control of brand identity.
Whose publications appear in the repo #
Never use a real person's personal blog — in a screenshot, a test fixture, a
code comment, a doc, or a REAL entry in scripts/capture-status-docs.mjs.
Use sites and projects (standard.site, atproto.com/blog), the author's own
publication (permadeath.com), or an obvious placeholder (example.com).
These pages end up in the docs, the Chrome Web Store listing and on
substandard.blog, and nobody outside the project agreed to be the extension's
model.
Using atgc #
When doing repo operations, always use the global install of atgc. atgc agent is compiled into the binary and provides an up-to-date view of the current version's capabilities.
Feature branch workflow #
If asked to do work, unless directly instructed otherwise, do not make changes to the user's top-level git checkout. All of your work will be on feature branches and inside git worktrees.
To start work on a feature branch:
- Run
git fetch origin main - Create the branch and its worktree:
git worktree add -b claude/short-feature-name .claude/worktrees/short-feature-name origin/main - Enter the worktree so that all commands run inside of it
- Double check that the repo-local
.git/config[user]section has an ATProto@-handle as anameand itsdid:plcas an email. If it does not, runatgc repo configure - Ensure that
prekis installed in your worktree viaprek install
While doing work, be a good neighbor to humans and agents on your machine:
- Do not restart, reload, or otherwise modify the configuration of shared services.
- If you need temporary folders or other artifacts that exist outside your worktree (such as Docker images), reduce conflicts by tagging them with your current branch and/or SHA.
- Check available system resources before running expensive commands (memory or CPU).
Make sure your work includes a "maintenance budget" for code directly related to your current feature:
- Reducing duplicated or dead code
- Adding new debug log lines and similar observability
- Updating documentation pages or test suites
- Checking off completed issues in TODO.md
Structure your commits for human review:
- Break work into a sequence of logical commits, typically 1-5 for an average feature.
- Use Conventional Commits, including adding "!" indicators for breaking behavior changes.
- Don't write more than 1 short sentence + 1 short paragraph into a commit body.
Confirm your work is acceptable before submitting a PR:
- Rebase onto
origin/mainand fix any conflicts. - Ensure that all
prekfeedback has been fixed. - Run the tests your change affects, and confirm they pass.
When your work is ready for review, you must create a pull request. When writing any PRs, updates to PRs, or comments on PRs:
- The PR title should be simple and descriptive, and should use Conventional Commits.
- The PR body should be three paragraphs at most. Focus on a concise, descriptive explanation of what changed. Avoid commentary on implementation details or future work.
- The PR body should contain a before/after screenshot if the change has a visible effect (UI, rendered output, a CLI's printed text). Attach this with Markdown image syntax and a local image path: the
atgccommands will upload it for you. The file does not need to be committed anywhere, and each image must be under 1 MB or the command refuses it before sending anything. - Do not report your work as "done" until you post the Tangled PR link for the user to review.
If the branch is a single reviewable feature, create the PR using atgc pr create.
If the branch holds several separable but related feature PRs that must land in a given order, use atgc stack create instead:
- Each PR carries multiple commits, and its own description and screenshots.
- Use
atgc stack markwhen you need to turn commit ranges into stacked feature PRs. - Use
atgc stack resubmitwhen you need to reconcile the upstream stack after any rebase, amend or reorder.
When review feedback arrives, you will need to submit a new "round" on the existing PR. Follow these steps for each round:
- Rebase against the latest
origin/main, or if stacked, useatgc stack sync. - Implement the requested changes.
- Repeat the required verification steps.
- Append a new review round to the PR with
atgc pr resubmit(non-stacked) oratgc stack resubmit(stacked). - Update the PR title, body and any new screenshots with
atgc pr edit.
After a feature is merged:
- Fetch
origin/main. - Confirm the work landed by checking that
git cherry origin/main <branch>prints no+lines. - Clean up your own worktree.
- Delete both the local and the remote feature branch, passing
-Dto account for the patch-based workflow. - Leave any temporary artifacts (like Docker images). Another agent may be using them, and they are a shared cache.
Driving the browser #
Several agents may share one Chrome and one 127.0.0.1. Both are global state.
- Pin your own port:
npm --prefix web run dev -- --port <5180-5199> --strictPort.web/astro.config.mjsalready binds127.0.0.1and already setsstrictPort, so a taken port fails loudly instead of drifting to the next free one; pass the flag anyway so the command stays right if the config changes. - Astro keeps one dev server per worktree, and runs it in the background when it detects an agent. A second
astro devin the same worktree attaches to the first and ignores your--portrather than failing, so check withastro dev statusbefore believing a screenshot, and end yours withastro dev stop. - Open pages with
isolatedContextset to your branch name. Cookies are scoped by host and ignore the port, so otherwise every agent on127.0.0.1shares one session and one agent signing out signs the others out. - Open with
background: trueso you do not steal the user's focus. select_pagesets one pointer for the whole browser, and another agent can move it between any two of your calls. Keep your ownpageId, re-select before each action, and confirmlocation.hrefis your port before you trust a screenshot, a snapshot, or a console read.- Pass an explicit
filePathtotake_screenshotand write under your scratchpad. - Close your pages when you are done. The last page cannot be closed.
- For anything behind sign-in use
npm --prefix web run dev:local-auth -- --port <yours> --strictPort. Without the port flags that script takes 5173 and collides with whoever holds it.VITE_LOCAL_AUTH=1switches sign-in toweb/src/devauth.ts, which skips headquarters-api and keeps tokens in the tab's IndexedDB — it is still a real OAuth login against a real PDS, so do not sign in at all just to check a layout. - A pinned port and the API disagree: the API admits exactly one web origin,
WEB_ORIGIN, defaulting tohttp://127.0.0.1:5173(see.env.example). If you need the API, start it withWEB_ORIGIN=http://127.0.0.1:<your port>, and expect to queue — one API can hold127.0.0.1:3000. A CORS error here is your port, not a bug.