These rules are mandatory for coding agents working in this repository.
Before making non-trivial changes, read the current coding-agent handoff notes:
docs/for_coding_agent/
Treat these notes as project memory for recent operational context, current deployment habits, and product lessons. If a turn produces durable knowledge that future coding agents need, add or update a document in this directory.
The project goal is to build an agent-first company organization.
- The user is the boss: they give goals, priorities, and approvals.
- Agents should coordinate like a company: clarify intent, split work, claim ownership, pass context, request review, produce evidence, and close the loop.
- Favor changes that reduce user micromanagement, improve agent-to-agent context transfer, make progress visible, and preserve useful knowledge.
- Do not optimize only for chat replies. Important work should update system state: tasks, goals, reviews, messages, and knowledge.
Never implement changes directly on main.
For every development task:
- Start from a clean working tree.
- Ensure the current branch is
main. - Pull or fetch the latest remote state when network access is available.
- Create a new task branch before editing files.
- Make all code, test, and documentation changes on that branch.
- Run the required verification commands.
- Commit on the task branch.
- Push the task branch to GitHub so the development process is preserved remotely.
- Merge back to
mainonly after verification passes. - Push
main. - Let the Cloudflare test environment deploy and verify it when the change is deployable.
- Deploy production only after the user explicitly approves promotion.
Use concise branch names:
git switch main
git switch -c <type>/<short-task-name>Examples:
git switch -c feat/cloudflare-auth
git switch -c fix/agent-start-rebind
git switch -c docs/cloudflare-runbook
git switch -c refactor/hub-coreBefore merging to main, run:
pnpm verifyIf the change touches Cloudflare Worker code, also run:
pnpm --filter @crewden/cloudflare exec wrangler deploy --dry-run
pnpm --filter @crewden/cloudflare exec wrangler deploy --config wrangler.test.jsonc --dry-runIf the change touches Cloudflare Pages deployment, also run:
VITE_API_BASE=https://crewden-hub-test.xingke0.workers.dev pnpm --filter @crewden/web buildIf a test or command fails, fix it on the task branch and rerun the failing command. Do not merge a failing branch.
Every deployable iteration must carry a version across components.
- Keep the default source version in
packages/shared/src/version.tsaligned with the project version when doing a named release. - CI/CD should inject the current commit SHA through
CREWDEN_VERSIONfor hub/server/daemon-style runtimes andVITE_APP_VERSIONfor the web build. - Do not hardcode a new component-local version if it can use the shared version helper or the build-time environment variable.
Every substantial development session should leave usable context for the next coding agent.
Use these locations consistently:
- Long-term rules and mandatory workflow constraints belong in
AGENTS.md. - Cross-session handoff summaries, runbooks, and reusable operational lessons belong in
docs/for_coding_agent/. - Product/version execution plans belong in
docs/v*.md. - Agent-local working context belongs in agent workspace
MEMORY.mdandnotes/. - Project-level reusable decisions, runbooks, lessons, user preferences, and archives should also be written through the Knowledge layer when available.
When exporting session knowledge:
- Summarize the current repository state and recent commits.
- Record changed components and key files.
- Record verification commands that passed or failed.
- Record common tool commands and invocation patterns.
- Record project-specific lessons and business/domain knowledge.
- Record known pitfalls and caveats.
- Prefer concise structured summaries over raw chat logs.
Never write secrets, auth tokens, API keys, or sensitive private data into AGENTS.md, docs, MEMORY.md, notes, transcripts, or Knowledge entries.
After verification passes:
git status --short
git add -A
git commit -m "<type>(scope): <summary>"
git push -u origin <task-branch>
git switch main
git merge --no-ff <task-branch>
git push origin mainIf the task branch already has an upstream, use git push origin <task-branch> after the commit. Do not delete the remote task branch unless the user explicitly asks; it is part of the development record.
Do not use git reset --hard, git checkout --, or destructive cleanup unless the user explicitly asks.
Cloudflare test is the default remote deployment target for deployable work.
- Test Worker:
crewden-hub-test - Test Worker URL:
https://crewden-hub-test.xingke0.workers.dev - Test Pages project:
crewden-web-test - Production Worker:
crewden-hub - Production Worker URL:
https://crewden-hub.xingke0.workers.dev - Production Pages project:
crewden-web
Production is the current live environment. Do not trigger production workflows, run deploy:prod, or deploy the crewden-web Pages project unless the user has explicitly approved promotion after test validation.
Expected flow:
- Merge verified work to
main. - Confirm the
Deploy Cloudflare Testworkflow succeeds. - Validate the user-facing behavior on the test Pages URL.
- Ask for production approval with the test result summary.
- Only after approval, manually run the production Hub and Pages workflows.
- When an agent claims or starts long-running work, the user should see a fast acknowledgement in the relevant channel or thread before the slow work continues.
- Task handoffs must carry enough context for the next agent: objective, background, constraints, acceptance criteria, dependencies, artifacts, and private notes when appropriate.
- Agent display names are not stable identifiers. Prefer agent id first, then unique name/display name when resolving a target.
- Do not mark meaningful work
donewithout concrete evidence. High-risk work should be reviewed by a different agent unless the user explicitly allows self-review with a reason. - Before context-dependent work, search project knowledge. Write durable decisions, user preferences, runbooks, failure lessons, and reusable facts back to knowledge. Do not store secrets or short-lived chat noise.
If the agent starts on a non-main branch:
- Continue on that branch if it clearly matches the user's task.
- Otherwise ask before switching branches if there are uncommitted changes.
- Never discard existing user changes.
Direct edits on main are allowed only when the user explicitly requests a hotfix on main. In that case, state the exception in the final response.