Knowledge Base

Copair builds up project-level knowledge over time in a file called COPAIR_KNOWLEDGE.md. This knowledge persists across sessions and can be shared with your team via version control.

How It Works

COPAIR_KNOWLEDGE.md lives at the root of your project:

your-project/
  COPAIR_KNOWLEDGE.md    <-- committed to git
  .copair/
    sessions/            <-- gitignored
    config.yaml
  src/
  ...

The agent reads this file at the start of every session and uses it as additional context. Over time, the knowledge base accumulates:

  • Architectural decisions
  • Project conventions and patterns
  • User preferences
  • Common pitfalls or gotchas

Agent-Driven Updates

When Copair learns something project-specific during a session, it may suggest adding it to the knowledge base:

I noticed this project uses a custom error handling pattern with
ErrorBoundary components. Should I add this to the knowledge base?

[y]es  [n]o

If you approve, the entry is appended to COPAIR_KNOWLEDGE.md with a timestamp.

Manual Editing

The knowledge base is a plain markdown file — you can edit it directly:

# COPAIR_KNOWLEDGE.md

## Architecture
- This project uses Next.js App Router with server components by default
- API routes live in `app/api/` and use edge runtime

## Conventions
- All components use named exports, not default exports
- Tests co-locate with source files: `foo.ts` / `foo.test.ts`

## Preferences
- Use pnpm, not npm or yarn
- Commit messages follow conventional commits

Entries are freeform. There's no required format — just write whatever helps the agent understand your project.

Size Limits

The knowledge base is bounded to prevent it from consuming too much of the model's context window:

SettingDefaultDescription
knowledge.warn_size_kb8Warn when the file exceeds this size in KB
knowledge.max_size_kb16Hard cap in KB — oldest entries are auto-pruned when exceeded

Configure in your project config:

# .copair/config.yaml
knowledge:
  warn_size_kb: 8
  max_size_kb: 16

Sharing via Git

COPAIR_KNOWLEDGE.md is designed to be committed to your repository. This means:

  • Team members get the same context when using Copair on the project
  • New contributors benefit from accumulated project knowledge
  • Changes are tracked in git history like any other project file

The .copair/sessions/ directory is gitignored by default — session data stays local. The knowledge base is the only Copair artifact intended for version control.

Cross-Project Knowledge

For knowledge that applies across all your projects, Copair supports a global knowledge base:

~/.copair/knowledge.md

This is read in addition to the project-level file. Use it for personal conventions, tool preferences, or patterns you follow everywhere.

Next Steps

Last updated May 12, 2026