Skip to content

Commit 795513d

Browse files
Add INIT.md for LLM session onboarding
1 parent ebfad7e commit 795513d

1 file changed

Lines changed: 76 additions & 0 deletions

File tree

INIT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# INIT.md - LLM Onboarding
2+
3+
Quick context for starting a new session on this project.
4+
5+
## What This Is
6+
7+
Browser-based git client using Nostr for sync events and Bitcoin for anchoring. No build step - single HTML files with CDN imports.
8+
9+
## Key Files
10+
11+
| File | Purpose |
12+
|------|---------|
13+
| `index.html` | Main app - clone repos, browse files, push with NIP-98 |
14+
| `contract-test.html` | Minimal contract experiment - "Add 500 sats" button |
15+
| `DESIGN.md` | Full architecture, features, future work |
16+
17+
## Tech Stack
18+
19+
- **Preact + htm**: React-like UI, no build step
20+
- **isomorphic-git**: Git in browser
21+
- **LightningFS**: IndexedDB filesystem
22+
- **@noble/curves**: Schnorr signatures (NIP-98)
23+
- All via `esm.sh` CDN imports
24+
25+
## What Works
26+
27+
1. Clone git repos to IndexedDB
28+
2. Browse files, preview HTML with local JSON injection
29+
3. Git push with NIP-98 authentication (Schnorr signatures)
30+
4. Auto-sync on Nostr 30617 events
31+
5. Minimal contract: add sats to webledger, commit, push
32+
33+
## Key Patterns
34+
35+
**NIP-98 Auth** (each HTTP request signed):
36+
```javascript
37+
const event = { kind: 27235, tags: [['u', url], ['method', method]] };
38+
const signed = await signEvent(event, privkey);
39+
headers['Authorization'] = 'Nostr ' + btoa(JSON.stringify(signed));
40+
```
41+
42+
**Contract pattern** (client-side validation):
43+
```javascript
44+
function addSats(state, pubkey, amount) {
45+
// Modify state
46+
state.updated = Math.floor(Date.now() / 1000);
47+
return state;
48+
}
49+
// Write to IndexedDB → git commit → push
50+
```
51+
52+
## Testing
53+
54+
```bash
55+
cd /home/melvin/projects/nostr-git-browser
56+
python -m http.server 3006
57+
# Open http://localhost:3006
58+
# Or http://localhost:3006/contract-test.html
59+
```
60+
61+
## Related Repos
62+
63+
- `/home/melvin/wl/20260202` - WebLedger data repo (synced via Nostr)
64+
- `nostr-git-sync` - Server-side daemon that pulls on 30617 events
65+
66+
## Next Steps (from DESIGN.md)
67+
68+
Priority candidates:
69+
- [ ] NIP-07 browser extension support (avoid raw privkey)
70+
- [ ] Publish 30617 events after push
71+
- [ ] Bitcoin commit anchoring (gitmark)
72+
- [ ] More contract actions (transfer, custom amounts)
73+
74+
## Config
75+
76+
Repos stored in `localStorage` as `nostr-git-config`. Private key in `nostr-git-privkey`.

0 commit comments

Comments
 (0)