Skip to main content

Init-deep

Generate scoped AGENTS.md files for key directories in the project. Each generated file describes the directory’s purpose, key files, exports, conventions, and subdirectory links, giving AI agents focused context for the code they are working with.

Generate context files

POST /api/init-deep
Traverse the project directory tree and generate AGENTS.md files for directories that need them.
This endpoint requires session-based authentication through NextAuth.

Request body

All fields are optional. An empty body or omitted Content-Type header is accepted.
FieldTypeRequiredDefaultDescription
pathstringNoProject rootRoot path to start generation from
forcebooleanNofalseOverwrite existing AGENTS.md files
dryRunbooleanNofalsePreview results without writing any files
maxDepthnumberNo5Maximum directory depth to traverse
curl -X POST https://agentbot.sh/api/init-deep \
  -H "Content-Type: application/json" \
  -d '{
    "force": false,
    "dryRun": true,
    "maxDepth": 3
  }'

Response

{
  "success": true,
  "summary": {
    "total": 15,
    "generated": 12,
    "skipped": 2,
    "errors": 1
  },
  "results": [
    {
      "path": "web/app/api",
      "generated": true,
      "skipped": false
    },
    {
      "path": "web/app/lib",
      "generated": false,
      "skipped": true,
      "error": "Already exists (use force: true to overwrite)"
    }
  ]
}
FieldTypeDescription
successbooleanWhether the operation completed without a fatal error
summary.totalnumberTotal directories evaluated
summary.generatednumberNumber of AGENTS.md files written
summary.skippednumberNumber of directories skipped (file already exists)
summary.errorsnumberNumber of directories where generation failed
resultsarrayPer-directory results
results[].pathstringRelative directory path
results[].generatedbooleanWhether an AGENTS.md was written
results[].skippedbooleanWhether the directory was skipped
results[].errorstringError message if generation failed or was skipped

Errors

CodeDescription
401Unauthorized — no valid session
500Failed to generate AGENTS.md files — an unexpected error prevented the operation. The detail field contains the error message.

Check generation status

GET /api/init-deep
Check which priority directories already have an AGENTS.md file. This endpoint does not require authentication.

Query parameters

ParameterTypeRequiredDefaultDescription
pathstringNoProject rootRoot path to check

Priority directories

The endpoint checks these directories by default:
  • web/app/api
  • web/app/lib
  • web/components
  • agentbot-backend/src
  • skills

Response

{
  "rootPath": "/project",
  "status": [
    {
      "directory": "web/app/api",
      "hasAgentsMd": true,
      "path": "/project/web/app/api"
    },
    {
      "directory": "web/app/lib",
      "hasAgentsMd": false,
      "path": "/project/web/app/lib"
    }
  ],
  "allGenerated": false
}
FieldTypeDescription
rootPathstringResolved root path used for the check
statusarrayStatus of each priority directory
status[].directorystringRelative directory name
status[].hasAgentsMdbooleanWhether an AGENTS.md file exists
status[].pathstringAbsolute path to the directory
allGeneratedbooleantrue when every priority directory has an AGENTS.md

Errors

CodeDescription
500Failed to check status — an unexpected error occurred