{"_id":"@5dc/coai","_rev":"2-2381dfe71c1fb78a1e59b461a5a15560","name":"@5dc/coai","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@5dc/coai","version":"0.0.1","keywords":["coai","documentation","navigation","markdown","git","pre-commit","vscode-extension"],"license":"MIT","_id":"@5dc/coai@0.0.1","maintainers":[{"name":"5dc","email":"c5cheng98@gmail.com"}],"homepage":"https://github.com/5Dcheng/coai#readme","bugs":{"url":"https://github.com/5Dcheng/coai/issues"},"bin":{"coai":"out/cli/coaiCli.js"},"dist":{"shasum":"7ed32e17877bf9ce78a6f0c378f622336af47bb4","tarball":"https://registry.npmjs.org/@5dc/coai/-/coai-0.0.1.tgz","fileCount":107,"integrity":"sha512-FpSNGl2CnUBRlOV6Nhuh5+gvSZK6ITrsvOiArXitAJ6wI8GE4eP0mm5ccp964Hu32U4uioH1qxEH7qA7kDqtKA==","signatures":[{"sig":"MEUCIQCQXnTI4Pm1Qyo+3jbZbm3zQWMtg27R1uGxY0UT+t71mwIgAipVTtMQeSVeHyvF0Qkba+vdu7w8Wwslk1dyTyhRvlo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":774943},"icon":"assets/c5dc.png","main":"./out/extension.js","_from":"file:5dc-coai-0.0.1.tgz","engines":{"vscode":"^1.96.0"},"scripts":{"build":"npm run clean && tsc -p .","clean":"node -e \"require('fs').rmSync('out', { recursive: true, force: true })\"","watch":"tsc -w -p .","package":"npm run package:tgz && npm run package:vsix","coai:init":"node ./out/cli/coaiCli.js init","coai:doctor":"node ./out/cli/coaiCli.js doctor","coai:update":"node ./out/cli/coaiCli.js update","package:tgz":"node ./scripts/package-tgz.js","coai:version":"node ./out/cli/coaiCli.js version","package:vsix":"node ./scripts/package-vsix.js","coai:coai-sync":"npm run build && node ./out/cli/coaiCli.js coai sync","coai:skill-sync":"npm run build && node ./out/cli/coaiCli.js skill sync","coai:check-update":"node ./out/cli/coaiCli.js check-update","coai:install-hook":"node ./out/cli/coaiCli.js install-hook","coai:restore-hook":"node ./out/cli/coaiCli.js restore-hook","coai:install-hooks":"node ./out/cli/coaiCli.js install-hooks","coai:uninstall-hook":"node ./out/cli/coaiCli.js uninstall-hook","coai:pre-commit-check":"node ./out/cli/coaiCli.js pre-commit-check"},"_npmUser":{"name":"5dc","email":"c5cheng98@gmail.com"},"_resolved":"E:\\c5dc\\coai\\coai_v1\\5dc-coai-0.0.1.tgz","publisher":"5dc","_integrity":"sha512-FpSNGl2CnUBRlOV6Nhuh5+gvSZK6ITrsvOiArXitAJ6wI8GE4eP0mm5ccp964Hu32U4uioH1qxEH7qA7kDqtKA==","categories":["Other"],"repository":{"url":"git+https://github.com/5Dcheng/coai.git","type":"git"},"_npmVersion":"11.1.0","contributes":{"commands":[{"title":"CoAI: Open mapped code","command":"coaiNavigation.openMappedCode"},{"title":"CoAI: Sync mapper from git changes","command":"coaiNavigation.syncMapperFromGitChanges"},{"title":"CoAI: Run pre-commit CoAI check","command":"coaiNavigation.runPreCommitCoaiCheck"},{"title":"CoAI: Install local pre-commit hook","command":"coaiNavigation.installGitHook"},{"title":"CoAI: Uninstall local pre-commit hook","command":"coaiNavigation.uninstallGitHook"},{"title":"CoAI: Restore pre-commit hook backup","command":"coaiNavigation.restoreGitHookBackup"},{"title":"CoAI: Resolve open bug log","command":"coaiNavigation.resolveOpenBugLog"},{"title":"CoAI: Reopen resolved bug log","command":"coaiNavigation.reopenResolvedBugLog"}],"configuration":{"title":"CoAI","properties":{"coaiNavigation.projectRoot":{"type":"string","default":".coai","description":"Root directory for project, mapper, and node data."}}}},"description":"VS Code extension plus CLI workflow for CoAI function docs, mapper sync, bug repair, and pre-commit checks.","directories":{},"displayName":"CoAI","_nodeVersion":"22.11.0","_hasShrinkwrap":false,"devDependencies":{"vsce":"^2.15.0","typescript":"^5.7.3","@types/node":"^22.10.2","@types/vscode":"^1.96.0"},"activationEvents":["onLanguage:markdown","onCommand:coaiNavigation.openMappedCode","onCommand:coaiNavigation.syncMapperFromGitChanges","onCommand:coaiNavigation.runPreCommitCoaiCheck","onCommand:coaiNavigation.installGitHook","onCommand:coaiNavigation.uninstallGitHook","onCommand:coaiNavigation.restoreGitHookBackup","onCommand:coaiNavigation.resolveOpenBugLog","onCommand:coaiNavigation.reopenResolvedBugLog"],"_npmOperationalInternal":{"tmp":"tmp/coai_0.0.1_1776952300380_0.41396552203107606","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@5dc/coai","displayName":"CoAI","description":"VS Code extension plus CLI workflow for CoAI function docs, mapper sync, bug repair, and pre-commit checks.","version":"0.0.2","publisher":"5dc","license":"MIT","repository":{"type":"git","url":"git+https://github.com/5Dcheng/coai.git"},"icon":"assets/c5dc.png","engines":{"vscode":"^1.96.0"},"categories":["Other"],"keywords":["coai","documentation","navigation","markdown","git","pre-commit","vscode-extension"],"activationEvents":["onLanguage:markdown","onCommand:coaiNavigation.openMappedCode","onCommand:coaiNavigation.syncMapperFromGitChanges","onCommand:coaiNavigation.runPreCommitCoaiCheck","onCommand:coaiNavigation.installGitHook","onCommand:coaiNavigation.uninstallGitHook","onCommand:coaiNavigation.restoreGitHookBackup","onCommand:coaiNavigation.resolveOpenBugLog","onCommand:coaiNavigation.reopenResolvedBugLog"],"main":"./out/extension.js","bin":{"coai":"out/cli/coaiCli.js"},"contributes":{"commands":[{"command":"coaiNavigation.openMappedCode","title":"CoAI: Open mapped code"},{"command":"coaiNavigation.syncMapperFromGitChanges","title":"CoAI: Sync mapper from git changes"},{"command":"coaiNavigation.runPreCommitCoaiCheck","title":"CoAI: Run pre-commit CoAI check"},{"command":"coaiNavigation.installGitHook","title":"CoAI: Install local pre-commit hook"},{"command":"coaiNavigation.uninstallGitHook","title":"CoAI: Uninstall local pre-commit hook"},{"command":"coaiNavigation.restoreGitHookBackup","title":"CoAI: Restore pre-commit hook backup"},{"command":"coaiNavigation.resolveOpenBugLog","title":"CoAI: Resolve open bug log"},{"command":"coaiNavigation.reopenResolvedBugLog","title":"CoAI: Reopen resolved bug log"}],"configuration":{"title":"CoAI","properties":{"coaiNavigation.projectRoot":{"type":"string","default":".coai","description":"Root directory for project, mapper, and node data."}}}},"scripts":{"clean":"node -e \"require('fs').rmSync('out', { recursive: true, force: true })\"","build":"npm run clean && tsc -p .","watch":"tsc -w -p .","package":"npm run package:tgz && npm run package:vsix","package:tgz":"node ./scripts/package-tgz.js","package:vsix":"node ./scripts/package-vsix.js","coai:pre-commit-check":"node ./out/cli/coaiCli.js pre-commit-check","coai:install-hook":"node ./out/cli/coaiCli.js install-hook","coai:install-hooks":"node ./out/cli/coaiCli.js install-hooks","coai:uninstall-hook":"node ./out/cli/coaiCli.js uninstall-hook","coai:restore-hook":"node ./out/cli/coaiCli.js restore-hook","coai:init":"node ./out/cli/coaiCli.js init","coai:version":"node ./out/cli/coaiCli.js version","coai:check-update":"node ./out/cli/coaiCli.js check-update","coai:update":"node ./out/cli/coaiCli.js update","coai:doctor":"node ./out/cli/coaiCli.js doctor","coai:skill-sync":"npm run build && node ./out/cli/coaiCli.js skill sync","coai:coai-sync":"npm run build && node ./out/cli/coaiCli.js coai sync"},"devDependencies":{"@types/node":"^22.10.2","@types/vscode":"^1.96.0","typescript":"^5.7.3","vsce":"^2.15.0"},"_id":"@5dc/coai@0.0.2","bugs":{"url":"https://github.com/5Dcheng/coai/issues"},"homepage":"https://github.com/5Dcheng/coai#readme","_integrity":"sha512-0qeWU7pn0m3Tl7LJ2DrpIc8RJ9B5EPG69nhDla+zJVagg0E2j/sC36SdO9mG17Eh4fA5obDPICKcr8G9r9BfYw==","_resolved":"E:\\c5dc\\coai\\coai_v1\\5dc-coai-0.0.2.tgz","_from":"file:5dc-coai-0.0.2.tgz","_nodeVersion":"22.11.0","_npmVersion":"11.1.0","dist":{"integrity":"sha512-0qeWU7pn0m3Tl7LJ2DrpIc8RJ9B5EPG69nhDla+zJVagg0E2j/sC36SdO9mG17Eh4fA5obDPICKcr8G9r9BfYw==","shasum":"dc0592c13686ffead65aeecdb27babab6676ff83","tarball":"https://registry.npmjs.org/@5dc/coai/-/coai-0.0.2.tgz","fileCount":113,"unpackedSize":3980849,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDKn6hbrSs6kczBX5gnc+xrsbaKbebuOV0K6kLmMaiCzAIhAJgBxK/vFfWDf5yePtga+T4CtpBuMKBHVXPWwhhJBi1O"}]},"_npmUser":{"name":"5dc","email":"c5cheng98@gmail.com"},"directories":{},"maintainers":[{"name":"5dc","email":"c5cheng98@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/coai_0.0.2_1778832851868_0.5343668892232742"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-23T13:51:40.295Z","modified":"2026-05-15T08:14:12.291Z","0.0.1":"2026-04-23T13:51:40.514Z","0.0.2":"2026-05-15T08:14:12.191Z"},"bugs":{"url":"https://github.com/5Dcheng/coai/issues"},"license":"MIT","homepage":"https://github.com/5Dcheng/coai#readme","keywords":["coai","documentation","navigation","markdown","git","pre-commit","vscode-extension"],"repository":{"type":"git","url":"git+https://github.com/5Dcheng/coai.git"},"description":"VS Code extension plus CLI workflow for CoAI function docs, mapper sync, bug repair, and pre-commit checks.","maintainers":[{"name":"5dc","email":"c5cheng98@gmail.com"}],"readme":"<p align=\"center\">\n  <img src=\"assets/pixel-coai-cut.png\" alt=\"CoAI pixel artwork\" width=\"720\">\n</p>\n\n<h1 align=\"center\">CoAI</h1>\n\n<p align=\"center\">\n  Project cognition layer for AI coding.\n</p>\n\n<p align=\"center\">\n  <a href=\"README_zh.md\"><strong>中文</strong></a>\n  ·\n  <a href=\"#quick-start\"><strong>Quick Start</strong></a>\n  ·\n  <a href=\"docs/ch/README.md\"><strong>Docs</strong></a>\n  ·\n  <a href=\"docs/effectiveness.md\"><strong>Effectiveness</strong></a>\n</p>\n\nCoAI is a project cognition layer for AI coding.\n\nIt lets developers describe features in natural language, express key flows with `[[double-link tokens]]`, and let AI agents connect those tokens back to real code locations. The faster a project evolves through AI coding, the more important it becomes to keep a shared, current, and navigable cognition layer for both humans and agents.\n\nCoAI does not replace specs, plans, or code. It preserves the stable understanding that survives the coding loop:\n\n```text\nfeature.md cognition alignment -> mapper skeleton -> code + anchor -> system line sync -> feature.md cognition backflow\n```\n\n## Why CoAI\n\n- AI can generate code quickly, but projects can become black boxes just as quickly. CoAI keeps the current meaning of the project inside the repository.\n- Chat history goes stale. `.coai/` grows with the project state, so humans and agents can resume from the current cognition layer.\n- Feature docs become code entry points. A flow like `[[User Input]] -> [[Frontend Submit]] -> [[Server Validation]]` can jump to real code.\n- Agents do not need to blindly scan the whole repo. `.coai/project`, `.coai/mapper`, `.coai/node`, and `@coai anchor` provide high-signal context.\n- CoAI encourages better feature and source-file boundaries because each capability must belong to a clear scenario event.\n- CoAI helps non-specialist builders describe business workflows first, then let agents turn them into coding-ready feature docs and implementation structure.\n\nIn one sentence:\n\n```text\nCoAI helps humans stay in control of projects written with AI.\n```\n\n## Best Fit\n\nUse CoAI when you:\n\n- build with Codex, Claude Code, Cursor, Trae, Cline, or similar AI agents\n- start a new project from a prompt, workflow, or business process\n- want product meaning, architecture understanding, feature flow, and code locations connected\n- want agents to understand project cognition before editing code\n- want long-running AI coding projects to stay readable, navigable, and maintainable\n\nNot recommended yet:\n\n- one-shot full migration of a large legacy project\n- using CoAI as a full spec / plan / task management system\n- storing every exploration path or chat log in `.coai/`\n\n## Quick Start\n\n### 1. Install\n\nRecommended:\n\n```bash\nnpm install -D @5dc/coai\nnpm exec coai init\n```\n\nFor non-Node host projects:\n\n```bash\nnpm install -D @5dc/coai\nnpm exec coai init --no-package-json\n```\n\nInstall the VS Code extension:\n\n```bash\ncode --install-extension coai-0.0.1.vsix --force\n```\n\nAfter Marketplace release, install it directly from VS Code Marketplace.\n\n### 2. Sync the skill\n\nCoAI is designed for agent-assisted work. Sync the local Codex skill:\n\n```bash\nnpm exec coai skill sync\n```\n\nFor the first CoAI session in a repository, tell the agent:\n\n```text\nUse the coai skill first and understand this repository's .coai structure.\nBefore discussing a feature, before writing code, and after implementation, follow the CoAI loop:\nfeature.md cognition alignment -> mapper skeleton -> code + anchor -> agent writes anchor/file back into mapper -> system updates line -> feature.md cognition backflow.\nEarly node flow is a revisable semantic hypothesis, not a hard implementation constraint.\n```\n\n### 3. Start with an agent\n\nFor a new project, do not manually create every `.coai` file. Describe the goal in chat and let the agent use CoAI:\n\n```text\nI want a simple registration feature:\nUser Input -> Frontend Submit -> Server Validation -> Local JSON Storage -> Success Response.\nUse CoAI to create the feature doc, mapper skeleton, and implementation.\n```\n\nIf you already have a product spec or project brief:\n\n1. initialize CoAI in the repository\n2. place the spec inside the local repo\n3. ask the agent to read the spec and create or update `.coai/project/<module>/<feature>.md`\n4. ask the agent to maintain mapper `anchor` and `file` while coding\n5. let CoAI sync mapper `line` through git-sync / pre-commit\n\n## How It Works\n\nCoAI has three deliverables:\n\n- `.coai/`: the host project's cognition layer\n- `@5dc/coai`: CLI, initializer, updater, local runtime, templates, and skill source\n- VS Code extension: Hover, Ctrl/Cmd Click, Problems panel, and command palette integration\n\nTypical workspace shape:\n\n```text\n.coai/\n├── current.md        # latest project progress\n├── project/          # module docs and feature docs\n├── mapper/           # token -> code mapping\n├── node/             # hover cognition\n├── log/bugs/         # CoAI bug lifecycle records\n└── coai/             # CoAI system assets and local runtime\n```\n\nCore responsibilities:\n\n- `project/<module>/<feature>.md`: feature goals, constraints, ideal path, branch paths, and exception boundaries\n- `mapper/<module>/<feature>.mapper.json`: maps `[[token]]` to `anchor/file/line`\n- `node/<module>/<feature>/*.node.json`: short hover cognition\n- `current.md`: latest project progress, not a replacement for feature docs\n\n## Double-Link Navigation\n\nIn a feature doc:\n\n```md\n[[User Input]] -> [[Frontend Submit]] -> [[Server Validation]] -> [[Local JSON Storage]] -> [[Success Response]]\n```\n\nIn code:\n\n```ts\n// @coai anchor: auth.register.validate.001\n```\n\nThen:\n\n- Hover `[[Server Validation]]` to view node cognition\n- Ctrl/Cmd Click `[[Server Validation]]` to jump to real code\n- git-sync / pre-commit keeps mapper `line` aligned through `@coai anchor`\n\n## CoAI vs Spec / Plan\n\nCoAI does not replace spec-driven development.\n\nThe responsibility split is:\n\n```text\nCoAI: project cognition and code location\nspec / plan: development process organization\ncoding agent: implementation execution\n```\n\nIn AI coding, CoAI is the cognition alignment and backflow layer:\n\n```text\nCoAI -> spec / plan / agent coding -> CoAI\n```\n\nIt does not store every process detail. It stores the feature meaning, key decisions, code entry points, and maintenance context that remain valid.\n\n## Benchmark and Effectiveness Validation\n\nCoAI validation separates three kinds of evidence:\n\n- System reliability: run real CLI, git-sync, pre-commit, mapper, and bug-log cases, then quantify metrics such as `passRate`, `mapperLineAccuracy`, and `bugTypeAccuracy`.\n- Agent cognition efficiency: compare A/B tasks with and without CoAI using target file accuracy, files read, lines read, wrong assumptions, and task success rate.\n- Developer black-box perception: before real developer samples exist, use only clearly labeled `SIMULATED_DATA` and never present simulated data as real user-study evidence.\n\nThe default benchmark workspace is `E:\\c5dc\\coai\\benchmark-workspaces`, outside the repository, to avoid polluting the codebase.\n\nCurrent measured evidence from the TeamDesk Lite experiment:\n\n- In a new-chat project cognition task, CoAI reduced source-file reads from 26 to 8 compared with the baseline, and the GLM-5-turbo billed usage dropped from 299,655 to 174,740 tokens in that run.\n- In R26-R30 maintenance tasks, CoAI did not reduce total files read, but it reduced source/config/test/data reads from 46 to 21 by shifting part of the exploration into `.coai` cognition assets.\n- A fresh `AGENTS.md` was cheaper for the single R31 usage task, but its generation cost was high and it requires manual updates before future new chats. This makes it a strong middle baseline, not a replacement for structured feature cognition, mapper/anchor source entry points, and cognition backflow.\n\nThis evidence supports a cautious product claim: CoAI helps preserve reusable, feature-oriented, source-locatable project cognition for long-running AI coding work. It does not prove that CoAI always reduces tokens or replaces source verification.\n\nDetails:\n\n- [Benchmark and Effectiveness Validation](docs/benchmark.md)\n- [CoAI Effectiveness Evidence](docs/effectiveness.md)\n\n## Commands\n\nCommon commands:\n\n```bash\nnpm exec coai init\nnpm exec coai update\nnpm exec coai skill sync\nnpm run coai:pre-commit-check\n```\n\nCommand layers:\n\n- package-management layer: `init`, `version`, `check-update`, `update`\n- workspace-local runtime layer: `doctor`, `pre-commit-check`, hook management\n\nDetails: [CLI Runtime Flow](docs/ch/cli-runtime-flow.md)\n\n## Documentation\n\nUser guides:\n\n- [CLI Runtime Flow](docs/ch/cli-runtime-flow.md)\n- [Runtime Modes](docs/ch/runtime-modes.md)\n- [Template Integration Protocol](docs/ch/template-integration-protocol.md)\n- [No package.json Mode](docs/ch/no-package-json-mode.md)\n- [Upgrade Paths](docs/ch/upgrade-paths.md)\n- [Manual Verification](docs/ch/manual-verification.md)\n- [Benchmark and Effectiveness Validation](docs/benchmark.md)\n- [CoAI Effectiveness Evidence](docs/effectiveness.md)\n\nTechnical docs:\n\n- [Feature and Source Boundary Rules](docs/ch/feature-boundary-rules.md)\n- [Contract Layer](docs/contract-layer.md)\n- [CoAI vs Spec Systems](docs/ch/coai-vs-spec.md)\n- [Skill Source](docs/ch/skill-source.md)\n- [Hook Policy](docs/ch/hook-policy.md)\n- [Repository Structure](docs/ch/structure.md)\n- [Roadmap and Strategy](docs/ch/roadmap-and-strategy.md)\n\nOpen release:\n\n- [Pre-open-source Strategy Draft](docs/ch/pre-open-source-strategy.md)\n\nChinese README:\n\n- [README_zh.md](README_zh.md)\n\n## Status\n\nCoAI v0.0.1 is an early public testing release:\n\n- VS Code Hover / Click navigation\n- CLI init and update\n- Git-based mapper line sync\n- fail-open pre-commit check\n- CoAI bug log and Problems panel\n- skill and template assets\n\nUse it first in new or controlled projects.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}