This file provides default context for automation tools (Codex, Cursor) so work is productive without manually selecting files.
- Monorepo for Footnote (a transparency- and provenance-focused AI framework) with Discord bot, backend core, and web site.
- Core principles: interpretability, traceability, cost tracking, fail-open behavior.
- Required annotations:
@footnote-module,@footnote-risk,@footnote-ethics,@footnote-scope. - Structured logging is mandatory; use scoped loggers from
packages/discord-bot/src/utils/logger.ts.
- Discord bot runtime:
packages/discord-bot/src/index.ts - Backend core:
packages/backend/src - Web app:
packages/web/src - Server wrapper:
server.js - Environment templates:
.env.example - Project docs:
README.md,docs/Philosophy_new.md,SECURITY.md
cursor.rules(authoritative development rules)packages/discord-bot/src/config.tspackages/discord-bot/src/utils/logger.tspackages/discord-bot/src/state/ChannelContextManager.tspackages/backend/src/storage/incidents/incidentStore.tspackages/backend/src/utils/pseudonymization.ts
- Preserve provenance comments and licensing headers.
- Use explicit types; avoid
any. - Record LLM costs via
ChannelContextManager.recordLLMUsage(). - Keep interfaces serializable for future UI integration.
- Use fail-open design: if uncertain, do not block execution.
- For API boundary code, keep OpenAPI links current:
- code annotations:
@api.operationId+@api.path - spec references:
x-codeRefsindocs/api/openapi.yaml
- code annotations:
- Prefer a junior-friendly teaching tone by default.
- Explain decisions in plain language first, then include technical detail.
- Keep explanations concrete and actionable.
- Write code comments in the same style: short, plain-language, and easy for a junior contributor to follow.
- Prefer comments that explain purpose, trigger, and consequence over comments that restate the code.
- Order:
@description,@footnote-scope,@footnote-module,@footnote-risk,@footnote-ethics(colon required). - Risk/Ethics annotations must include a short rationale on the same line.
- Canonical reference:
docs/architecture/footnote-annotations.md.
Example:
/**
* @description: Handles realtime audio streaming and event dispatch for the bot.
* @footnote-scope: core
* @footnote-module: RealtimeEventHandler
* @footnote-risk: high - Audio/event failures can break live conversations or leak resources.
* @footnote-ethics: high - Realtime audio handling impacts privacy and consent expectations.
*/- Run ESLint by default after any file edit.
- Prefer linting only the touched files when the repo tooling supports it cleanly.
- If the repo only exposes a broader lint command, run that broader command and note the wider validation scope.
- Review:
pnpm review @footnote-*tags:pnpm validate-footnote-tags- OpenAPI linking:
pnpm validate-openapi-links
- When reviewing or summarizing changes that affect correctness or safety
(schemas, validators, CI gates, auth, provenance/audit logging, policy enforcement),
explicitly state:
- invariants (what must always be true)
- at least one realistic failure mode
- the test(s), validation(s), or CI check(s) that would catch that failure
- If no such check exists, say so plainly as a gap.
- Do not present correctness/safety-critical changes as review-ready unless those invariants, failure modes, and checks can be explained concretely from the code and validation setup.
- CodeRabbit is installed in the terminal and can be used for code review support.
- Run
cr -hto view available commands. - Prefer CodeRabbit with
--prompt-only. - To review uncommitted changes:
coderabbit --prompt-only -t uncommitted. - Run CodeRabbit no more than 3 times per set of changes.
- Bot:
packages/discord-bot/src/events,packages/discord-bot/src/commands,packages/discord-bot/src/voice - Realtime audio:
packages/discord-bot/src/realtime - Shared prompts:
packages/backend/src/services/prompts - Web UI:
packages/web/src/components,packages/web/src/pages
Avoid loading secrets, logs, traces, or build artifacts (see .codexignore).