AGENTS.md Integration
Society Protocol supports the AGENTS.md standard from the Agentic AI Foundation (Linux Foundation). AGENTS.md is used by 60,000+ open-source projects and supported by Google, OpenAI, Factory, Sourcegraph, and Cursor.
What is AGENTS.md?
Section titled “What is AGENTS.md?”AGENTS.md is a plain Markdown file that helps AI coding assistants (Claude Code, Cursor, Goose, etc.) understand and work with your project. It provides:
- Project description and context
- Build/test commands
- Code style conventions
- MCP server configuration
- Security guidelines
Generate AGENTS.md
Section titled “Generate AGENTS.md”Society Protocol includes a generator that creates AGENTS.md files with Society integration built in:
import { generateAgentsMd } from 'society-protocol';
const agentsMd = generateAgentsMd({ projectName: 'My Agent Project', description: 'A multi-agent research system using Society Protocol.', room: 'my-research-room', federation: 'research-team', mcpServer: 'npx society-protocol mcp', a2aAgentCard: '/.well-known/agent.json', buildCommands: { build: 'npm run build', test: 'npm test', dev: 'npm run dev', }, codeStyle: { language: 'TypeScript', formatter: 'prettier', conventions: [ 'Use explicit types, avoid any', 'Prefer interface over type for objects', ], }, security: [ 'All messages are Ed25519-signed', 'Validate capability tokens before actions', ], capabilities: ['p2p', 'knowledge-pool', 'coc'], knowledgeSpaces: ['project-docs', 'research-notes'],});
// Write to project rootimport { writeFileSync } from 'fs';writeFileSync('AGENTS.md', agentsMd);Output
Section titled “Output”The generated file includes:
- Project name and description
- Society Protocol room/federation info
- MCP server configuration (JSON)
- Build commands
- Code style guidelines
- Security notes
Parse Existing AGENTS.md
Section titled “Parse Existing AGENTS.md”import { parseAgentsMd } from 'society-protocol';import { readFileSync } from 'fs';
const content = readFileSync('AGENTS.md', 'utf-8');const config = parseAgentsMd(content);
console.log(config.projectName); // 'My Agent Project'console.log(config.room); // 'my-research-room'console.log(config.capabilities); // ['p2p', 'knowledge-pool', 'coc']Generate Society’s Own AGENTS.md
Section titled “Generate Society’s Own AGENTS.md”import { generateSocietyAgentsMd } from 'society-protocol';
const md = generateSocietyAgentsMd();// Generates the AGENTS.md for Society Protocol itselfSymlink with CLAUDE.md
Section titled “Symlink with CLAUDE.md”For compatibility with Claude Code, create a symlink:
ln -s AGENTS.md CLAUDE.mdThis ensures both Claude Code and other AI tools find the instructions.
Best Practices
Section titled “Best Practices”Following the AAIF’s “ruthless minimalism” principle:
- Keep it short — Frontier LLMs follow ~150-200 instructions consistently
- Lead with context — One-sentence project description first
- Only non-obvious commands — Skip
npm install, include custom commands - Progressive disclosure — Link to detailed docs instead of inlining everything
- Include MCP config — Makes Society tools available to AI assistants
- Security section — Always include security-relevant instructions
File Placement
Section titled “File Placement”| Location | Scope |
|---|---|
Root AGENTS.md | Entire project |
packages/api/AGENTS.md | API package only |
services/auth/AGENTS.md | Auth service only |
Subdirectory files merge with root. Closest file takes precedence.