Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

CLAUDE.md

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

CLAUDE.mdBlame189 lines · 1 contributor
fc1817aClaude1# gluecron
2
3AI-native code intelligence platform — git hosting, automated CI, and green ecosystem enforcement.
4
d0bc8c2Claude5## Section 0 — SESSION START PROTOCOL (mandatory)
6
7Every session begins by loading memory. Do these in order:
8
91. Read `.memory/project-state.md` — current status snapshot
102. Read `.memory/last-session.md` — what was just built, what's next
113. Read `.memory/open-questions.md` — anything needing owner input
124. Run `git log --oneline -5` — verify branch state
135. Run `bun test 2>&1 | tail -3` — verify tests pass
14
15If any file is missing, note it and proceed. Never ask the user to provide context you can read from these files.
16
17## Section 1 — HARD RULES
18
19### Rule 1: Never forget context
20- Session memory lives in `.memory/`. Read it. Use it. Update it.
21- If you don't know something, check memory files before asking.
22- Cross-session continuity is non-negotiable.
23
24### Rule 2: Never sit idle
25- This is a revenue-generating product. Idle time = lost revenue.
26- See something broken? Fix it. See a gap? Build it. Finished a task? Start the next one.
27- Prioritize: Security fixes > broken functionality > performance > new features > polish.
28- When in doubt, build. The worst outcome is sitting idle.
29
30### Rule 3: Never ship broken code
31- `bun test` must pass before every commit.
32- Run tests after every change. If tests break, fix them immediately.
33- Commit and push frequently. Small, focused commits.
34- Every user-facing failure mode has a fallback — no 500s reach the UI.
35
36## Section 2 — SESSION END PROTOCOL (mandatory)
37
38Before the session ends or context compacts:
39
401. Update `.memory/last-session.md` with: what was built, what was fixed, branch state, what's next
412. Update `.memory/project-state.md` if architecture changed
423. Append new decisions to `.memory/decisions-log.md`
434. Update `.memory/open-questions.md` if new questions arose
445. Commit memory files with message: `chore: update session memory`
45
46## Section 3 — Agent Policy — NEVER IDLE
9837657Claude47
48**This is a revenue-generating product. Idle time = lost revenue.**
49
50Every session must ship value. The rules:
51
521. **See something broken? Fix it.** Don't report it and wait — fix it, commit, push.
532. **See a missing feature that would advance the platform? Build it.** Don't ask permission for obvious improvements.
543. **Finished a task? Start the next one.** Audit the codebase for gaps, performance issues, missing tests, broken flows. Always have the next thing queued.
554. **Run tests after every change.** `bun test` must pass before pushing. If tests break, fix them immediately.
565. **Commit and push frequently.** Small, focused commits. Don't batch 10 features into one push.
576. **Prioritize by impact:** Security fixes > broken functionality > performance > new features > polish.
587. **When in doubt, build.** The worst outcome is sitting idle. The second worst is asking "should I?" when the answer is obviously yes.
59
d0bc8c2Claude60## Section 4 — READ FIRST — every session
9ab6971Claude61
62**`BUILD_BIBLE.md` is mandatory reading for every Claude agent before any code changes.**
63
64It contains:
65- Agent policy (do-not-undo rule, continuous-build rule)
66- GitHub parity scorecard (what's shipped vs missing)
67- Numbered build plan (Blocks A–H)
68- Locked components that cannot be altered without owner permission
69- Session workflow
70
71Do not skip it. Do not refactor locked files. Do not stop mid-block.
72
d0bc8c2Claude73## Section 5 — Stack
fc1817aClaude74
75- **Runtime:** Bun
76- **Framework:** Hono (with JSX for server-rendered views)
77- **Database:** Drizzle ORM + Neon (PostgreSQL)
78- **Git:** Smart HTTP protocol via git CLI subprocesses
79
d0bc8c2Claude80## Section 6 — Development
fc1817aClaude81
82```bash
83bun install # install dependencies
84bun dev # start dev server (hot reload)
85bun test # run tests
86bun run db:migrate # run database migrations
87```
88
d0bc8c2Claude89## Section 7 — Architecture
fc1817aClaude90
91```
92src/
43de941Claude93 index.ts Entry point (Bun server)
94 app.tsx Hono app composition + error handlers
95 lib/
96 config.ts Environment config (getters, reads env at access time)
97 auth.ts Password hashing (bcrypt), session tokens
98 highlight.ts Syntax highlighting (highlight.js, 40+ languages)
99 markdown.ts Markdown rendering (GFM + syntax highlighting)
fc1817aClaude100 db/
43de941Claude101 schema.ts Drizzle schema (all tables)
102 index.ts Lazy DB connection (proxy pattern)
103 migrate.ts Migration runner
fc1817aClaude104 git/
43de941Claude105 repository.ts Git operations (tree, blob, commits, diff, branches, blame, search, raw)
106 protocol.ts Smart HTTP protocol (pkt-line, service RPC)
fc1817aClaude107 hooks/
43de941Claude108 post-receive.ts GateTest + Crontech webhooks on push
109 middleware/
110 auth.ts softAuth + requireAuth middleware
fc1817aClaude111 routes/
43de941Claude112 git.ts Git HTTP endpoints (clone/push)
113 api.ts REST API (repo CRUD, setup)
114 auth.tsx Register, login, logout (web + API)
115 web.tsx Web UI (file browser, commits, diffs, search, blame, raw)
116 issues.tsx Issue tracker (CRUD, comments, close/reopen)
117 pulls.tsx Pull requests (create, review, merge, close)
118 editor.tsx Web file editor (create/edit via git plumbing)
119 compare.tsx Branch comparison (diff + commit list)
120 settings.tsx User settings (profile, SSH keys)
121 repo-settings.tsx Repository settings (description, visibility, delete)
122 webhooks.tsx Webhook management + delivery engine
123 fork.ts Repository forking
124 explore.tsx Explore/discover public repos
125 tokens.tsx Personal access tokens
126 contributors.tsx Contributor list + commit activity graph
fc1817aClaude127 views/
43de941Claude128 layout.tsx HTML shell + CSS (dark theme) + auth-aware nav
129 components.tsx UI components (file table, commit list, diff viewer, etc.)
fc1817aClaude130```
131
43de941Claude132## Database Schema
133
134- `users` — accounts with bcrypt password hashing
135- `sessions` — cookie-based auth sessions (30 day expiry)
136- `repositories` — repos with fork tracking, star/fork/issue counts
137- `stars` — user-repo star relationships
138- `issues` — issue tracker with open/closed state
139- `issue_comments` — threaded comments on issues
140- `labels` + `issue_labels` — issue categorization
141- `pull_requests` — PRs with base/head branches, open/closed/merged state
142- `pr_comments` — PR comments with AI review flag + file/line annotations
143- `activity_feed` — event log for repos
144- `webhooks` — registered webhook URLs with HMAC secret + event filtering
145- `api_tokens` — personal access tokens with SHA-256 hashing
146- `repo_topics` — repository tags for discoverability
147- `ssh_keys` — user SSH public keys
148
fc1817aClaude149## Integrations
150
151- **GateTest:** POST `https://gatetest.ai/api/scan/run` on every `git push`
152- **Crontech:** POST `https://crontech.ai/api/trpc/tenant.deploy` on push to main
43de941Claude153- **Webhooks:** POST to registered URLs on push/issue/PR/star events with HMAC signatures
fc1817aClaude154
155## Environment Variables
156
157See `.env.example` for required variables. Key ones:
158- `DATABASE_URL` — Neon PostgreSQL connection string
159- `GIT_REPOS_PATH` — directory for bare git repos (default: `./repos`)
160- `PORT` — HTTP port (default: 3000)
d0bc8c2Claude161
162## Section 8 — ESCAPE HATCHES
163
164User can override any rule at any time:
165
166- `just do X` — skip memory protocol and just do the thing
167- `rule check` — agent re-reads CLAUDE.md and confirms compliance
168- `memory check` — agent reads all .memory/ files and summarizes current state
169- `skip tests` — commit without running tests (use sparingly)
170- `stop` — end the session immediately, update memory first
171
172## Section 9 — DRIFT PREVENTION
173
174Every 10 tool calls, silently verify:
1751. Am I still following the hard rules?
1762. Has the conversation drifted from the build plan?
1773. Are tests still passing?
178
179If drift is detected, self-correct without being asked. If tests are failing, fix before continuing.
180
181## Section 10 — COMPETITIVE INTELLIGENCE
182
183The mission: **annihilate GitHub**. Continuously evaluate:
184- What does GitHub charge enterprise prices for that we ship free?
185- What is GitHub slow at that we can make instant?
186- What manual workflow can we automate with AI?
187- What's missing from every code hosting platform that developers wish existed?
188
189Every session should advance at least one competitive advantage.