mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 19:05:11 +00:00
12 examples showing increasing levels of customization: - 01-minimal: all defaults - 02-custom-model: model and thinking level - 03-custom-prompt: replace or modify prompt - 04-skills: discover, filter, merge skills - 05-tools: built-in tools, custom tools - 06-hooks: logging, blocking, result modification - 07-context-files: AGENTS.md files - 08-slash-commands: file-based commands - 09-api-keys-and-oauth: API key resolution, OAuth config - 10-settings: compaction, retry, terminal settings - 11-sessions: persistence options - 12-full-control: replace everything Also exports FileSlashCommand type from index.ts
36 lines
901 B
TypeScript
36 lines
901 B
TypeScript
/**
|
|
* Context Files (AGENTS.md)
|
|
*
|
|
* Context files provide project-specific instructions loaded into the system prompt.
|
|
*/
|
|
|
|
import { createAgentSession, discoverContextFiles, SessionManager } from "../../src/index.js";
|
|
|
|
// Discover AGENTS.md files walking up from cwd
|
|
const discovered = discoverContextFiles();
|
|
console.log("Discovered context files:");
|
|
for (const file of discovered) {
|
|
console.log(` - ${file.path} (${file.content.length} chars)`);
|
|
}
|
|
|
|
// Use custom context files
|
|
const { session } = await createAgentSession({
|
|
contextFiles: [
|
|
...discovered,
|
|
{
|
|
path: "/virtual/AGENTS.md",
|
|
content: `# Project Guidelines
|
|
|
|
## Code Style
|
|
- Use TypeScript strict mode
|
|
- No any types
|
|
- Prefer const over let`,
|
|
},
|
|
],
|
|
sessionManager: SessionManager.inMemory(),
|
|
});
|
|
|
|
console.log(`Session created with ${discovered.length + 1} context files`);
|
|
|
|
// Disable context files:
|
|
// contextFiles: []
|