ccrider
AGENTS.md0 starsChanged 12 months agoMITView on GitHub
This codebase follows strict Core/Interface separation based on Saša Jurić's "Towards Maintainable Elixir: The Core and the Interface". The core contains business logic that applies REGARDLESS of which interface uses it: Test: "Would this be different for CLI vs TUI vs MCP?" Interfaces translate between protocols and core: This logic must be in core - it's a business rule that applies to ALL interfaces. Move to core. Interface should call db.ListSessions(projectFilter). If date filtering is a business requirement (applies to…
1 other project uses a version of this.
Adopted by
Most recently taken up by
- neilberkman/ccriderword for word, first seen Sep 13, 2026
Other versions1 project uses a version of this.
Word for word · 1
- neilberkman/ccrider★ 132100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Data Retrieval: All database queries, FTS searches, external API calls
- Distinctive: line 53
No SQL queries: - All database access through core functions
- Distinctive: line 54
No business logic: - Don't decide what's "valid" or "meaningful"
- Distinctive: line 56
No direct database imports: - Use core types and functions
- Distinctive: line 99
If date filtering is a business requirement (applies to all interfaces), move to core.
- Distinctive: line 100
If it's MCP-specific (other interfaces don't need it), it can stay but only if clearly protocol-specific.
- Distinctive: line 128
Before adding logic to interface layer, ask:
- Distinctive: line 180
When to truncate (pagination limits)
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Core/Interface Separation Philosophy
This codebase follows strict Core/Interface separation based on Saša Jurić's "Towards Maintainable Elixir: The Core and the Interface".
Principles
CORE Layer (internal/core/)
The core contains business logic that applies REGARDLESS of which interface uses it:
- Data Retrieval: All database queries, FTS searches, external API calls
- Business Rules: Filtering out warmup sessions, summary fallback logic, validation
- Data Transformation: Converting raw database rows into domain types
- Domain Types: Structs that represent business concepts (
Session,SessionDetail,SearchResult,Stats) - Pure Business Operations: Logic that would be identical whether you have CLI, TUI, MCP, or web API
Test: "Would this be different for CLI vs TUI vs MCP?"
- NO → Core
- YES → Interface
Examples:
- ✅ CORE: "Get all sessions, excluding those with no meaningful content"
- ✅ CORE: "Search messages using FTS5"
- ✅ CORE: "Calculate last working directory from message history"
- ❌ NOT CORE: "Show 20 sessions" (that's pagination - interface concern)
- ❌ NOT CORE: "Format timestamp as 'Jan 2, 2006'" (that's presentation - interface concern)
INTERFACE Layer (internal/interface/, cmd/ccrider/mcp/)
Interfaces translate between protocols and core:
- Protocol Translation: HTTP, CLI flags, MCP JSON, TUI key bindings
- Input Normalization: Parse
project:foo after:yesterdayinto filter structs - Output Formatting: Convert
time.Timeto "Jan 2" or RFC3339 or "2 hours ago" - Pagination/Limits: Decide to show 20 vs 50 vs 10 results
- Presentation: Colors, tables, progress bars, JSON structure
- Grouping: "Show 3 matches per session" (core returns ALL matches)
Examples:
- ✅ INTERFACE: Strip quotes from user's search query
- ✅ INTERFACE: Apply limit of 50 sessions to display
- ✅ INTERFACE: Group search results by session for display
- ✅ INTERFACE: Format date as "2 days ago" for terminal
- ✅ INTERFACE: Parse
after:2024-01-01from search string
Rules
❌ NEVER in Interface Layers:
- No SQL queries - All database access through core functions
- No business logic - Don't decide what's "valid" or "meaningful"
- No filtering by business rules - Core decides if warmup sessions are excluded
- No direct database imports - Use core types and functions
✅ DO in Interface Layers:
- Call core functions -
db.ListSessions(),search.Search() - Transform for display - Format dates, truncate text, add colors
- Apply presentation limits - Pagination, "show 3 matches per session"
- Parse user input - Convert CLI flags/TUI keys/MCP params into core function calls
- Handle protocol concerns - JSON marshaling, terminal rendering, progress bars
Common Violations to Avoid
🚨 Filtering in Interface
// ❌ WRONG - business logic in interface
for _, session := range sessions {
if session.Summary != "" && !strings.Contains(session.Summary, "warmup") {
// Only show non-warmup sessions
}
}This logic must be in core - it's a business rule that applies to ALL interfaces.
🚨 Database Queries in Interface
// ❌ WRONG - SQL in interface layer
rows, err := database.Query("SELECT * FROM sessions WHERE project_path LIKE ?", filter)Move to core. Interface should call db.ListSessions(projectFilter).
🚨 Date Filtering in Interface
// ❌ WRONG - business logic about date ranges
if args.AfterDate != "" && coreResult.Timestamp < args.AfterDate {
continue
}If date filtering is a business requirement (applies to all interfaces), move to core. If it's MCP-specific (other interfaces don't need it), it can stay but only if clearly protocol-specific.
✅ Correct Separation
// ✅ CORE - business logic
func (db *DB) ListSessions(projectPath string) ([]Session, error) {
// SQL query with business rules:
// - Exclude sessions with no meaningful content
// - Fallback summary to first user message
// - Order by updated_at DESC
}
// ✅ INTERFACE - presentation
func runList(cmd *cobra.Command, args []string) error {
sessions, err := database.ListSessions(projectFilter) // Call core
if len(sessions) > listLimit {
sessions = sessions[:listLimit] // Apply display limit
}
for _, s := range sessions {
fmt.Printf("[%d] %s\n", i, s.SessionID)
fmt.Printf(" Updated: %s\n", formatTimestamp(s.UpdatedAt)) // Format for display
}
}When Working on Code
Before adding logic to interface layer, ask:
"Would CLI and TUI and MCP all need this same logic?"
- YES → Move to core
- NO → Keep in interface
"Is this about WHAT data to get or HOW to display it?"
- WHAT → Core
- HOW → Interface
- "Does this involve a database query or business rule?"
- YES → Core
- NO → Probably interface
File Organization
internal/core/
├── db/ # Database operations, domain types
│ ├── db.go # Connection, base types
│ ├── sessions.go # Session queries: ListSessions, GetSessionDetail, GetSessionLaunchInfo
│ └── stats.go # Stats queries: GetStats
└── search/ # Search operations
└── search.go # FTS5 search: Search, SearchCode
internal/interface/
├── cli/ # Command-line interface
│ ├── list.go # Calls db.ListSessions(), formats as table
│ ├── stats.go # Calls db.GetStats(), formats as table
│ └── debug_prompt.go # Calls db.GetSessionLaunchInfo(), formats prompt
└── tui/ # Terminal UI
└── messages.go # Calls search.Search(), formats as colored list
cmd/ccrider/mcp/
└── server.go # MCP server
# Calls search.Search(), db.GetSessionDetail(), db.ListSessions()
# Formats as JSON for MCP protocolSummary
Core = What and Why
- What data to retrieve
- Why certain sessions are excluded
- What constitutes "valid" data
Interface = How and When
- How to display data (colors, format, structure)
- When to truncate (pagination limits)
- How user specifies what they want (CLI flags, TUI keys, MCP params)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

