{"id":51338392,"url":"https://github.com/sunset331/ai-hooks","last_synced_at":"2026-07-02T05:01:18.826Z","repository":{"id":368581428,"uuid":"1285816692","full_name":"sunset331/ai-hooks","owner":"sunset331","description":"Persistent project memory for AI coding. SQLite events, git hooks, Claude Code integration.","archived":false,"fork":false,"pushed_at":"2026-07-01T07:28:10.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-01T09:20:38.978Z","etag":null,"topics":["ai-coding","claude","claude-code","developer-tools","git-hooks","project-memory","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunset331.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-01T07:07:10.000Z","updated_at":"2026-07-01T07:40:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sunset331/ai-hooks","commit_stats":null,"previous_names":["sunset331/ai-hooks"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sunset331/ai-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunset331%2Fai-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunset331%2Fai-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunset331%2Fai-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunset331%2Fai-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunset331","download_url":"https://codeload.github.com/sunset331/ai-hooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunset331%2Fai-hooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35033492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-coding","claude","claude-code","developer-tools","git-hooks","project-memory","sqlite"],"created_at":"2026-07-02T05:00:35.784Z","updated_at":"2026-07-02T05:01:18.817Z","avatar_url":"https://github.com/sunset331.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ai-hooks — Persistent Project Memory for AI Coding\n\n```text\nAI loses memory between sessions.\nThis project fixes that.\n```\n\nClose Claude Code. All context gone. Switch projects. Re-read everything. Pick up a repo after a week. Start from zero.\n\n**ai-hooks gives Claude Code persistent project memory.** It records every commit, checkout, and AI action as events in SQLite, auto-injects them when you start a session, and keeps STATUS.md always current.\n\nNo cloud. No API. No vendor lock-in. Just a Bash script, a Python SQLite wrapper, and git hooks.\n\n```text\ngit commit\n    │\n    ▼\nSQLite Events ──→ Project State ──→ Claude Session (auto-injected on start)\n                                      → STATUS.md (auto-rendered)\n```\n\n## Quick Start\n\n```bash\n# 1. One command to install\ngit clone https://github.com/sunset331/ai-hooks.git\ncd ai-hooks \u0026\u0026 bash install.sh\n\n# 2. One command to add to any project\nai-init ~/my-project\n\n# 3. Work normally. That's it.\ngit commit -m \"fix: login bug\"      # → event + state auto-recorded\ngit checkout feature-branch         # → state summary printed\n# next Claude Code session → context auto-injected\n```\n\n| Situation | Without ai-hooks | With ai-hooks |\n|-----------|-----------------|---------------|\n| Close Claude Code | Lose all context | Auto-injected next session |\n| Switch projects | Re-read everything | Smart Resume picks up where you left off |\n| STATUS.md outdated | Drift, stale | Auto-rendered every commit |\n| State corrupted | Manual recovery | `doctor --repair` auto-rebuilds from events |\n| `__pycache__` in commit | Caught at PR review | Warning at commit time |\n| New AI tool joins | Starts from zero | Reads same `.ai/` files |\n\n## Architecture\n\n```\n.ai/                           # Per-project (created by ai-init)\n├── project.db                 # SQLite — events + state\n├── STATUS.md                  # Auto-rendered (read-only)\n├── MEMORY.md                  # You write: bugs, fixes, milestones\n├── DECISIONS.md               # You write: architecture rationale\n├── CHECKLIST.md               # Review checklist\n└── WORKFLOW.md                # Project workflow\n\n.claude/\n├── settings.json              # SessionStart hook for context injection\n└── skills/ai-review/SKILL.md  # /ai-review command\n\nData flow:\n    git commit → post-commit hook\n        → record_event.py → SQLite events (append-only)\n        → update_state.py → SQLite state (KV, upsert)\n        → render_state.py → STATUS.md (overwrite)\n    next Claude start → SessionStart hook → db.py summary → context\n    daily → Task Scheduler → scheduler-check.ps1 → health check (read-only)\n```\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `ai-init \u003cdir\u003e` | Initialize `.ai/` system in a project (idempotent) |\n| `ai-doctor \u003cdir\u003e` | Diagnose `.ai/` health |\n| `ai-update \u003cdir\u003e` | Upgrade hooks path + DB schema |\n| `ai-uninstall \u003cdir\u003e` | Remove hook config (keeps `.ai/` data) |\n\n## Events\n\nEvery state change is an append-only event. No data loss, full audit trail.\n\n| Type | Trigger | Payload |\n|------|---------|---------|\n| `commit` | post-commit hook | `{sha, message, date, author}` |\n| `checkout` | post-checkout hook | `{branch, from}` |\n| `ai_session` | Claude Code | `{action, model, summary}` |\n| `scheduler_check` | Task Scheduler | `{status, dirty_count, warnings}` |\n\n```bash\nsqlite3 .ai/project.db \"SELECT id, type, payload FROM events\"\n```\n\n## Who Is This For\n\n- **You use Claude Code daily** and hate losing context between sessions\n- **You juggle multiple projects** and need instant state recovery\n- **You want your AI memory to outlive any specific tool**\n- **You care about engineering fundamentals** — events, state, SQLite — not prompt hacks\n\n## Requirements\n\n- Bash 4+\n- Python 3.8+ (with sqlite3)\n- Git (optional: hooks need it, `.ai/` files work without)\n\n## Supported AI Tools\n\n- **Claude Code** — Full support (hooks, sessions, skill)\n- **Any AI** — `.ai/` is plain Markdown + SQLite, zero dependency on any provider\n\n## License\n\nMIT\n\n---\n\n*[中文使用手册](https://github.com/sunset331/ai-hooks/blob/master/docs/usage-zh.md)* — 完整的中文文档\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunset331%2Fai-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunset331%2Fai-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunset331%2Fai-hooks/lists"}