aibridge-context
v1.4.1
Published
Zero-config CLI and library for generating AI-readable project context, serving it locally, and syncing it with git.
Downloads
997
Maintainers
Readme
aibridge-context
aibridge-context is a zero-config CLI and Node.js library that turns a project into an AI-readable workspace. It maintains a live .ai-context/ folder, serves it locally, and can optionally sync context updates through git.
Think of it as Git for AI context.
⚠️ Public AI Access Warning
When GitHub sync is enabled, your project context becomes publicly accessible via a URL.
Do NOT use this tool with sensitive data.
Quick Start
npx aibridge-context init
npx aibridge-context link-github
npx aibridge-context startHow It Works
- Tracks project changes
- Generates structured AI context
- Syncs to GitHub (optional)
- Creates a public URL
- AI tools read this URL for context
Usage
This package exposes a CLI command:
aibridgeWhen using npx, always use the package name:
npx aibridge-context initAfter installing globally, you can use:
aibridge init
aibridge link-githubFeatures
- Zero-config startup for Node.js projects
- Debounced file watching powered by
chokidar - Atomic writes to avoid corrupted JSON files
- Local Express server for AI-friendly endpoints
- Optional git auto-sync for
.ai-context/* - Library exports for embedding in other tooling
Install
npm installTo use the local CLI in this repository:
npx aibridge-context init
npx aibridge-context link-github
npx aibridge-context startIf published to npm, the package exposes the aibridge binary.
ai-context is supported as a legacy alias.
Using With AI
After enabling GitHub sync, use:
https://raw.githubusercontent.com/<user>/<repo>/main/.ai-context/state.jsonThis URL always returns the latest project state.
Paste this into any AI:
Use this as source of truth:
https://raw.githubusercontent.com/<user>/<repo>/main/.ai-context/state.jsonYou can also share:
https://raw.githubusercontent.com/<user>/<repo>/main/.ai-context/brain.txtTypical flow:
npx aibridge-context init
aibridge link-github
npx aibridge-context startCommands
aibridge init
Creates .ai-context/ and writes:
state.jsonbrain.txtcontext.mdchangelog.jsonconfig.json
aibridge start
Starts:
- A debounced file watcher
- A local Express server
- Automatic state updates on add/change/delete events
Default server port: 3333
aibridge update
Triggers a manual context refresh and optional git sync.
aibridge link-github
Prompts for a GitHub repository URL, links origin, pushes main, saves the repo URL to .ai-context/config.json, and enables public AI sync output.
Generated files
.ai-context/state.json
Tracks:
- project name
- version
- last update time
- change statistics
- recent updates
- project features
- next steps
.ai-context/brain.txt
Provides instructions any AI assistant should follow before responding.
.ai-context/context.md
Stores a human-readable summary including:
- project purpose
- detected stack
- AI usage guidance
.ai-context/changelog.json
Stores historical change entries captured by the watcher.
.ai-context/config.json
Default configuration:
{
"port": 3333,
"debounceMs": 600,
"gitSync": {
"enabled": false,
"push": true,
"commitMessage": "auto: update AI context",
"remote": "origin",
"branch": "main",
"repoUrl": ""
}
}HTTP endpoints
When aibridge start is running:
GET /state.jsonGET /brain.txtGET /context.mdGET /changelog.json
Example usage
npx aibridge-context init
npx aibridge-context startThen point your AI tool to:
http://localhost:3333/state.jsonhttp://localhost:3333/context.mdhttp://localhost:3333/changelog.jsonhttp://localhost:3333/brain.txt
Git sync
Git sync is optional and controlled by .ai-context/config.json.
Enable it like this:
{
"gitSync": {
"enabled": true,
"push": true,
"commitMessage": "auto: update AI context"
}
}On every successful update, the tool will attempt to:
git add .ai-context
git commit -m "auto: update AI context"
git pushFailures are handled gracefully and will not stop the watcher or server.
Library usage
const {
initProject,
startWatcher,
updateProjectState,
startServer,
syncContextToGit
} = require('aibridge-context');Development notes
- CommonJS is used for simplicity and broad compatibility.
- The watcher ignores
node_modules,.git, and.ai-context. - Writes are atomic via temporary-file rename.
- Updates are debounced to reduce noisy file churn.
