lantern
CLAUDE.md31 starsChanged 4 months agoMITView on GitHub
Conventional Commits: type: description Release Note Awareness: Type Selection: Critical: fix only for user-facing bugs. Internal fixes (linter errors, type errors, build scripts) use chore. Message Quality Examples: Lantern reads Claude Code session logs straight from JSONL files (~/.claude/projects/), zero data loss. Web client built as CLI tool serving Vite app. Core Architecture: Project aims for fast feedback AND code quality (checks pass = runtime correctness near-guaranteed) via: Implement with t-wada TDD style. pnpm gatecheck check runs all above checks…
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
The file
We split this CLAUDE.md into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 11
Use as type casting anywhere, tests included (explain problem to user instead)
- Very specific: line 12
Use raw fetch or bypass TanStack Query for API calls
- Very specific: line 13
Run pnpm dev or pnpm start (dev servers)
- Very specific: line 14
Use node:fs, node:path, etc.
- Very specific: line 21
Run pnpm typecheck and pnpm fix before commit
- Distinctive: line 29
Commit messages ship in release notes.
- Distinctive: line 76
After source change, always run before commit:
- Distinctive: line 104
No class-based implementations or mutable variables for state
- Distinctive: line 105
Use Effect-TS functional patterns for state
- Very specific: line 185
Session Logs: Read ~/.claude/projects/ JSONL files to learn data structures
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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
CLAUDE.md
Critical Rules (Read First)
Language:
- Code, comments, commits in English
NEVER:
- Use
astype casting anywhere, tests included (explain problem to user instead) - Use raw
fetchor bypass TanStack Query for API calls - Run
pnpm devorpnpm start(dev servers) - Use
node:fs,node:path, etc. directly (use Effect-TS equivalents)
ALWAYS:
- Effect-TS for all backend side effects
- Hono RPC + TanStack Query for all API calls
- TDD: tests first, then implement
- Run
pnpm typecheckandpnpm fixbefore commit
Commit Message Rules
Conventional Commits: type: description
Release Note Awareness:
- Commit messages ship in release notes. Write for users.
Type Selection:
| Type | Release Note | Purpose |
feat | Features | User-facing new feature |
fix | Bug Fixes | User-impacting bug fix |
chore, ci, build, refactor | Excluded | Internal changes |
Critical: fix only for user-facing bugs. Internal fixes (linter errors, type errors, build scripts) use chore.
Message Quality Examples:
- Bad:
fix: fix lingui error(internal issue) - Bad:
feat: add button(too vague) - Good:
feat: add dark mode toggle to settings - Good:
fix: session list not updating after deletion - Good:
chore: update lingui compiled messages
Project Overview
Lantern reads Claude Code session logs straight from JSONL files (~/.claude/projects/), zero data loss. Web client built as CLI tool serving Vite app.
Core Architecture:
- Frontend: Vite + TanStack Router + React 19 + TanStack Query
- Backend: Hono (standalone server) + Effect-TS (all business logic)
- Data: Direct JSONL reads, strict Zod validation
- Real-time: Server-Sent Events (SSE) for live updates
Recommended Coding Process
Project aims for fast feedback AND code quality (checks pass = runtime correctness near-guaranteed) via:
- Strict typing with Effect-TS and ADT
- Quality constraints pushed into Lint where possible
- Dependency injection + effective testing with Effect-TS
Implement with t-wada TDD style.
pnpm gatecheck check runs all above checks against diff at once. Loop: detect problem, fix, repeat.
Gives fast static checks + unit tests.
Quality Gate (MUST follow)
After source change, always run before commit:
pnpm gatecheck check
./scripts/lingui-check.shKey Directory Patterns
src/server/hono/route.ts- Hono API routes (all routes here)src/server/core/- Effect-TS business logic (domain modules: session, project, git, etc.)src/lib/conversation-schema/- Zod schemas for JSONL validationsrc/testing/layers/- Reusable Effect test layers (testPlatformLayeris foundation)src/routes/- TanStack Router routes
Coding Standards
Backend: Effect-TS
Prioritize Pure Functions:
- Extract logic into pure, testable functions when possible
- Pure functions easier to test, reason about, maintain
- Effect-TS only when side effects or state needed
Use Effect-TS for Side Effects and State:
- Mandatory for I/O, async code, stateful logic
- No class-based implementations or mutable variables for state
- Use Effect-TS functional patterns for state
- Reference: https://effect.website/llms.txt
Testing with Layers:
import { expect, test } from "vitest";
import { Effect } from "effect";
import { testPlatformLayer } from "@/testing/layers";
import { yourEffect } from "./your-module";
test("example", async () => {
const result = await Effect.runPromise(yourEffect.pipe(Effect.provide(testPlatformLayer)));
expect(result).toBe(expectedValue);
});Avoid Node.js Built-ins:
FileSystem.FileSysteminstead ofnode:fsPath.Pathinstead ofnode:pathCommand.stringinstead ofchild_process
Enables dependency injection and proper testing.
Type Safety - NO as Casting:
ascasting strictly prohibited- Types unsolvable without
as? Explain problem to user, ask guidance - Valid alternatives: type guards, assertion functions, Zod schema validation
Frontend: API Access
Hono RPC + TanStack Query Only:
import { api } from "@/lib/api";
import { useQuery } from "@tanstack/react-query";
const { data } = useQuery({
queryKey: ["example"],
queryFn: () => api.endpoint.$get().then((res) => res.json()),
});Raw fetch and direct requests prohibited.
Tech Standards
- Linter/Formatter: oxlint + oxfmt (not ESLint/Prettier/Biome)
- Type Config:
@tsconfig/strictest - Path Alias:
@/*maps to./src/*
Architecture Details
SSE (Server-Sent Events)
When to Use SSE:
- Session log updates to frontend
- Background process state change notifications
- Never for request-response (use Hono RPC)
Implementation:
- Server:
/api/sseendpoint, type-safe events (TypeSafeSSE) - Client:
useServerEventListenerhook for subscriptions
Data Layer
- Single Source of Truth:
~/.claude/projects/*.jsonl - Cache:
~/.lantern/(invalidated via SSE when source changes) - Validation: Strict Zod schemas capture every field
Session Process Management
Claude Code processes stay alive in background (unless aborted), so session continues without changing session-id.
Development Tips
- Session Logs: Read
~/.claude/projects/JSONL files to learn data structures - Fixtures:
fixtures/claude-home/is fake~/.claudedir — demo sessions plus one project per JSONL entry shape. Unit tests read it;--claude-dir ./fixtures/claude-homeruns app against it. - Effect-TS Help: https://effect.website/llms.txt
References
Project conventions and procedures. Progressive Disclosure: read only reference you need, when you need it.
| Path | When to Read |
docs/guidelines/commit_message.md | Before commit |
docs/guidelines/branch_naming.md | Before creating branch |
docs/guidelines/definition_of_done.md | Before marking task done |
docs/guidelines/qa_guideline.md | Verifying implemented features. Delegate to QA or general-purpose subagent with this file path |
docs/guidelines/internal_review.md | Requesting code review |
docs/dev.md | Build pipeline, test strategy, data layer and release flow in depth |
docs/README.md | Index of every user-facing and contributor doc |
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.

