{"id":29008455,"url":"https://github.com/presidio-oss/cor-matrix","last_synced_at":"2025-08-01T16:09:29.666Z","repository":{"id":301133584,"uuid":"996847415","full_name":"presidio-oss/cor-matrix","owner":"presidio-oss","description":"Track and analyze AI-generated code retention in your codebase. Measure how much originally AI-generated code survives vs gets modified over time.","archived":false,"fork":false,"pushed_at":"2025-07-29T13:12:36.000Z","size":242,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-29T15:47:01.656Z","etag":null,"topics":["ai-assistant","ai-code-analysis","ai-generated-code","code-metrics","code-origin","code-tracking","developer-tools","development-analytics","retention-analysis"],"latest_commit_sha":null,"homepage":"https://npmjs.org/@presidio-dev/cor-matrix","language":"TypeScript","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/presidio-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-05T14:53:26.000Z","updated_at":"2025-07-29T13:12:40.000Z","dependencies_parsed_at":"2025-06-25T10:43:33.418Z","dependency_job_id":"d25d8d7d-7aec-4d6e-a7e9-9e31cfd5a124","html_url":"https://github.com/presidio-oss/cor-matrix","commit_stats":null,"previous_names":["presidio-oss/cor-matrix"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/presidio-oss/cor-matrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/presidio-oss%2Fcor-matrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/presidio-oss%2Fcor-matrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/presidio-oss%2Fcor-matrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/presidio-oss%2Fcor-matrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/presidio-oss","download_url":"https://codeload.github.com/presidio-oss/cor-matrix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/presidio-oss%2Fcor-matrix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268257242,"owners_count":24221054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"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-assistant","ai-code-analysis","ai-generated-code","code-metrics","code-origin","code-tracking","developer-tools","development-analytics","retention-analysis"],"created_at":"2025-06-25T14:05:44.373Z","updated_at":"2025-08-01T16:09:29.658Z","avatar_url":"https://github.com/presidio-oss.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# COR-Matrix\n\n**Code Origin Ratio Matrix** - Track and analyze how much AI-generated code survives in your codebase over time.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"assets/img/cor-matrix.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"assets/img/cor-matrix.png\"\u003e\n    \u003cimg alt=\"architecture\" src=\"assets/img/cor-matrix.png\" \"\u003e\n  \u003c/picture\u003e\n\u003c/div\u003e\n\n## What is COR-Matrix?\n\nCOR-Matrix helps development teams understand the real-world impact of AI-generated code by tracking what percentage of originally AI-generated code remains unchanged versus modified or removed during development.\n\n**The Problem:** Teams using AI coding assistants don't know if the generated code is actually useful long-term or gets rewritten immediately.\n\n**The Solution:** COR-Matrix captures signatures of AI-generated code as it's written, then analyzes your codebase later to show retention rates and code evolution patterns.\n\n## Quick Start\n\n### 1. Start the API Server\n\n#### Option A: Using Docker Compose (Recommended)\n\n```bash\n# Set up environment variables\ncp .env.example .env\n# Edit .env file with your actual values\n\n# Start the API server with Docker\ndocker-compose up -d\n```\n\n#### Option B: Local Development\n\n```bash\n# Install dependencies\nbun install\n\n# Set up environment variables\ncp .env.example .env\n# Edit .env file with your actual values\n\n# Run database migrations\nbun run db:push\n\n# Start the API server\nbun run dev:api\n```\n\nThe API will be available at `http://localhost:3000` with documentation at `http://localhost:3000/docs`.\n\n### 2. Track AI-Generated Code (SDK)\n\nInstall the client SDK in your project:\n\n```bash\nnpm install @presidio-dev/cor-matrix\n```\n\nIntegrate tracking into your development workflow:\n\n```javascript\nimport { CorMatrix } from \"@presidio-dev/cor-matrix\";\n\nconst corMatrix = new CorMatrix({\n  appName: \"my-app\",\n  baseURL: \"http://localhost:3000\",\n  token: \"your-workspace-token\",\n  workspaceId: \"your-workspace-id\",\n});\n\n// Track AI-generated code as you write it\ncorMatrix.addCodeOriginRecord({\n  code: \"console.log('Hello from AI');\",\n  path: \"src/index.ts\",\n  language: \"typescript\",\n  generatedBy: \"copilot\",\n});\n```\n\n### 3. Generate Reports (CLI)\n\nAnalyze your codebase to see AI code retention:\n\n```bash\nnpx @presidio-dev/cor-matrix report \\\n  --workspace-id your-workspace-id \\\n  --project-path /path/to/your/project \\\n  --api-url http://localhost:3000 \\\n  --api-token your-workspace-token\n```\n\nExample output:\n\n```\n COR-Matrix Report\n────────────────────────────────────────────────────────────────\nCodebase Path:                  /path/to/your/project\nReport Time:                    June 1, 2025 at 6:00 PM\nTotal Lines:                    961 (100%)\nAI-Written Lines:               40 of 961 (4.16%)\n────────────────────────────────────────────────────────────────\n```\n\n## Development\n\n```bash\n# Database operations\nbun run db:generate    # Generate migrations\nbun run db:push        # Apply migrations\nbun run db:studio      # Open database GUI\n\n# Development\nbun run dev:api        # Start API server with hot reload\nbun run build:client   # Build client SDK\nbun run build:api      # Build API Docker image\n```\n\n## Architecture\n\n- **API Server**: Elysia.js REST API with SQLite database\n- **SDK**: Node.js library for real-time code tracking\n- **CLI**: Command-line tool for codebase analysis\n- **Database**: Stores code signatures and workspace data\n\nBuilt with TypeScript, Bun, Drizzle ORM, and Docker.\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Security\n\nFor security concerns, please see our [Security Policy](SECURITY.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpresidio-oss%2Fcor-matrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpresidio-oss%2Fcor-matrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpresidio-oss%2Fcor-matrix/lists"}