{"id":50865363,"url":"https://github.com/koompi/nimmit-brain-api","last_synced_at":"2026-06-15T00:33:33.950Z","repository":{"id":350808154,"uuid":"1208336604","full_name":"koompi/nimmit-brain-api","owner":"koompi","description":"Brain lesson aggregation API — accepts lessons from Nimmit instances, creates PRs to koompi/nimmit-brain","archived":false,"fork":false,"pushed_at":"2026-04-26T07:02:03.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-15T00:32:57.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koompi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-12T06:11:14.000Z","updated_at":"2026-04-26T07:02:08.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/koompi/nimmit-brain-api","commit_stats":null,"previous_names":["koompi/nimmit-brain-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/koompi/nimmit-brain-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koompi%2Fnimmit-brain-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koompi%2Fnimmit-brain-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koompi%2Fnimmit-brain-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koompi%2Fnimmit-brain-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koompi","download_url":"https://codeload.github.com/koompi/nimmit-brain-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koompi%2Fnimmit-brain-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34343312,"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-06-14T02:00:07.365Z","response_time":62,"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":[],"created_at":"2026-06-15T00:33:33.103Z","updated_at":"2026-06-15T00:33:33.935Z","avatar_url":"https://github.com/koompi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nimmit-brain-api\n\nBrain lesson aggregation API for Nimmit. Accepts lessons from Nimmit instances worldwide, creates PRs to `koompi/nimmit-brain`. Zero friction — no GitHub account needed.\n\n**Live at:** https://nimmit.koompi.ai\n\n## Why\n\nNimmit Brain users learn from their AI interactions. This API lets those lessons flow back to the community — automatically, privately, and without needing a GitHub account.\n\nSee [koompi/nimmit-brain](https://github.com/koompi/nimmit-brain) for the brain template.\n\n## Endpoints\n\n| Method | Path | Description |\n|--------|------|-------------|\n| `GET` | `/` | Service info and endpoint list |\n| `GET` | `/api/v1/brain/health` | Health check |\n| `POST` | `/api/v1/brain/lessons` | Submit lessons |\n| `GET` | `/api/v1/brain/lessons?since=2026-04-01` | Fetch recent community lessons |\n\n## Submit Lessons\n\n```bash\ncurl -X POST https://nimmit.koompi.ai/api/v1/brain/lessons \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"brainVersion\": \"2.1.0\",\n    \"lessons\": [\n      {\n        \"category\": \"procedural\",\n        \"name\": \"Match User Language\",\n        \"trigger\": \"User switches between languages mid-conversation\",\n        \"lesson\": \"Detect the language of each message and respond in the same language. Don't ask — just switch.\",\n        \"source\": \"Learned from bilingual user interactions\"\n      }\n    ]\n  }'\n```\n\n### Response (success)\n\n```json\n{\n  \"status\": \"accepted\",\n  \"lessonsReceived\": 1,\n  \"contribution\": {\n    \"commitSha\": \"abc123...\",\n    \"filesChanged\": 1\n  }\n}\n```\n\n### Response (validation error)\n\n```json\n{\n  \"error\": \"Validation failed\",\n  \"details\": [\n    \"Lesson \\\"Personal Greeting\\\" appears to contain personal data. Generalize before submitting.\"\n  ]\n}\n```\n\n## Privacy\n\nThe API enforces privacy at the server level. Submissions containing personal data are rejected with 400.\n\n| Blocked | Pattern |\n|---------|---------|\n| Emails | `user@example.com` |\n| Phone numbers | `+855 12 345 678`, `091234567` |\n| Internal URLs | `192.168.x.x`, `.local` |\n| API keys/tokens | Long alphanumeric strings near \"key\"/\"token\"/\"secret\" |\n| Personal names with context | `Mr. X said...`, `H.E. Y told...` |\n| Telegram/user IDs | 9-10 digit numbers with user/chat context |\n\nLessons must be **generalized** before submission. The brain template handles this automatically.\n\n## Lesson Schema\n\n```typescript\ninterface Lesson {\n  category: \"procedural\" | \"semantic\" | \"workflow\" | \"anti-pattern\";\n  name: string;        // max 200 chars\n  trigger: string;     // max 1000 chars — when does this apply?\n  lesson: string;      // max 5000 chars — what should the agent do?\n  source: string;      // max 500 chars — generic description, no personal data\n}\n```\n\n### Categories\n\n| Category | Description | Stored At |\n|----------|-------------|-----------|\n| `procedural` | How to do things better | `brain/memory/procedural/` |\n| `semantic` | What things are (domain knowledge) | `brain/memory/semantic/` |\n| `workflow` | Process and workflow improvements | `brain/memory/workflow/` |\n| `anti-pattern` | Things to avoid | `brain/memory/failures/` |\n\n## Rate Limits\n\n- 10 requests per minute per IP\n- 50 lessons per submission\n- 5000 characters per lesson\n\n## How It Works\n\n```\nNimmit instance → POST /api/v1/brain/lessons\n        │\n        ▼\nValidate (schema + privacy check)\n        │\n        ▼\nCreate GitHub branch → commit lesson files → create PR\n        │\n        ▼\nKOOMPI Nimmit reviews PR weekly → merges or requests changes\n        │\n        ▼\nOther Nimmit instances GET /api/v1/brain/lessons → pull updates\n        │\n        ▼\nEveryone gets smarter\n```\n\n## Deploy\n\n### Cloudflare Workers (recommended)\n\n```bash\ngit clone https://github.com/koompi/nimmit-brain-api.git\ncd nimmit-brain-api\nbun install\n\n# Set secrets\necho \"production\" | CLOUDFLARE_API_TOKEN=xxx bunx wrangler secret put ENVIRONMENT\necho \"ghp_xxx\" | CLOUDFLARE_API_TOKEN=xxx bunx wrangler secret put GITHUB_TOKEN\n\n# Deploy\nCLOUDFLARE_API_TOKEN=xxx bunx wrangler deploy\n\n# Add custom domain in Cloudflare dashboard\n# nimmit.koompi.ai → worker\n```\n\n### KOOMPI Cloud / Self-hosted\n\n1. Set environment variables: `ENVIRONMENT=production`, `GITHUB_TOKEN=ghp_xxx`\n2. Run: `bun run start`\n3. Reverse proxy `nimmit.koompi.ai` → port 3000\n\n### Local Dev\n\n```bash\nbun install\nbun run dev\n# API at http://localhost:3000\n# ENVIRONMENT not set = dev mode (accepts lessons, no GitHub sync)\n```\n\n## Environment Variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `ENVIRONMENT` | Yes | Must be `production` for GitHub sync |\n| `GITHUB_TOKEN` | Yes | GitHub PAT with `repo` scope for `koompi/nimmit-brain` |\n| `LESSON_WEBHOOK_SECRET` | No | Optional webhook secret for future use |\n\n## Tech Stack\n\n- [Hono](https://hono.dev) — fast web framework (works on Cloudflare Workers, Bun, Node)\n- [Cloudflare Workers](https://workers.cloudflare.com) — serverless deployment\n- [GitHub API](https://docs.github.com/rest) — PR creation and lesson fetching\n- TypeScript strict\n\n## License\n\nApache License 2.0 — see [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoompi%2Fnimmit-brain-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoompi%2Fnimmit-brain-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoompi%2Fnimmit-brain-api/lists"}