What is readfirst?
readfirst is a repository tool that keeps a team’s rules, risks, and checks alongside its code, then shows the relevant guidance before a person or AI agent changes a file. It can connect that guidance to Claude Code, Cursor, Codex, Gemini, and other agents, and add checks to a GitHub pull request workflow. The local CLI runs on Node 20 or later, supports any programming language, and does not send code over the network.
readfirst Features:
Repository Map: A reviewed .readfirst/map.json groups files and records the rules, risks, checks, and related files that matter for each group.
File Guidance: The read command shows a file’s applicable rules, risks, checks, tests that reach it, and files that use it.
Agent Connections: Claude Code can receive guidance through a hook, while MCP and Cursor rules make the same map available to other tools.
Pull Request Checks: The GitHub Action comments on pull requests with relevant guidance and reports when changed code is not covered by the map.
Repository Audits: The audit command identifies stale rules, risky code without test coverage, replaced code that is still used, and areas it could not inspect.
Code Discovery: The find command lists existing functions, files, and map entries that may already serve a purpose, with the most-used results first.
readfirst Benefits:
Preserved Team Knowledge: People and agents can see conventions and cautions that may not be obvious from imports or the code itself, reducing reliance on informal handoffs.
Focused Testing: Showing checks for the files being changed helps developers spend their testing effort on the work at hand.
Fewer Duplicates: Finding existing functions before writing new code makes it easier to reuse established helpers instead of creating another version.
Earlier Gaps: Pull request coverage reports make missing map entries visible during code review, when the team can address them alongside the change.
Consistent Guidance: Keeping agent instructions and pull request checks tied to one map reduces the need to maintain separate guidance for each tool.
Use Cases:
Payment Changes: Before editing payment code, give an agent the relevant risks and the payment checks the team expects to run.
Shared Data Tables: When changing a table or its columns, check which files use it and whether the map identifies related code that should change too.
Agent Code Edits: Connect a coding agent to repository-specific rules before it modifies a file, so the agent can account for local conventions.
Pull Request Review: Use the GitHub Action to review applicable guidance and identify changed files that the repository map does not cover.
Existing Code Search: Before adding a helper or repeating a calculation, search the repository for functions and files that may already do the job.

