Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: stop folders swallowing their siblings in llms.txt; fix auth folder link

Kshitij Jhunjhunwala4124f713b3c9
diff --git a/docs/agent/instructions/context.md b/docs/agent/instructions/context.md
index 91752397c..5c85b73d5 100644
--- a/docs/agent/instructions/context.md
+++ b/docs/agent/instructions/context.md
@@ -20,14 +20,14 @@ This is your always-on map of Composio's concepts and the canonical page for eac
- **How auth works** — Composio uses Connect Links (hosted auth pages) and **auth configs** (per-toolkit blueprints) to create **connected accounts** (stored credentials) scoped to a userID. This is the page for "how does authentication work". → [Authentication](/docs/authentication)
- **Auth schemes / modes** — a toolkit's auth config uses one of `OAUTH2`, `API_KEY`, `BEARER_TOKEN`, or `BASIC`. When you mention a toolkit's auth mode, link the reference rather than explaining it inline. → [Auth schemes](/reference/api-reference/auth-configs#auth-schemes) for what each mode is and when it's used, [Authentication](/docs/authentication) for how auth works overall, and [Managed vs custom auth](/docs/authentication/custom-app-vs-managed-app) for choosing or bringing your own scheme.
-- **In-chat auth** — the agent prompts the user to connect via `COMPOSIO_MANAGE_CONNECTIONS`. → [In-chat authentication](/docs/authenticating-users/in-chat-authentication)
-- **Manual auth** — generate Connect Links yourself with `session.authorize()`. → [Manually authenticating users](/docs/authenticating-users/manually-authenticating)
+- **In-chat auth** — the agent prompts the user to connect via `COMPOSIO_MANAGE_CONNECTIONS`. → [In-chat authentication](/docs/authentication#in-chat-authentication)
+- **Manual auth** — generate Connect Links yourself with `session.authorize()`. → [Manually authenticating users](/docs/authentication/manually-authenticating)
- **Managed vs custom auth** — use Composio's managed OAuth apps, or bring your own for branding/scopes. → [Managed vs custom auth](/docs/authentication/custom-app-vs-managed-app)
- **White-labeling** — remove Composio branding from the auth flow. → [White-labeling authentication](/docs/authentication/white-labeling-authentication)
- **Callback identity verification** — opt-in per-project defense against OAuth session fixation, documented in the connected-accounts API overview: set a verifier URL and Composio holds each OAuth connection until the developer's server confirms the returning user (`complete_auth`); once set it covers every OAuth connection in the project. This is the section for "connections from the dashboard stopped completing" and "a real `user_id` is now required". → [Callback identity verification](/reference/api-reference/connected-accounts#callback-identity-verification)
- **Importing existing connections** — pass in API keys or bearer tokens you already hold. → [Importing existing connections](/docs/authentication/importing-existing-connections)
- **Multiple accounts per user** — e.g. work and personal Gmail. → [Managing multiple connected accounts](/docs/authentication/managing-multiple-connected-accounts)
-- **Shared connections** — share one connected account across users via an ACL. → [Shared connections](/docs/authenticating-users/shared-connections)
+- **Shared connections** — share one connected account across users via an ACL. → [Shared connections](/docs/extending-sessions/shared-connections)
## Triggers and webhooks
diff --git a/docs/app/llms.txt/route.ts b/docs/app/llms.txt/route.ts
index 5ae09e2d6..57321cd22 100644
--- a/docs/app/llms.txt/route.ts
+++ b/docs/app/llms.txt/route.ts
@@ -47,14 +47,29 @@ function isLegacySeparator(name: ReactNode): boolean {
* Walk the fumadocs page tree and generate a markdown index.
* Separators become ## headings, pages become URL entries, folders recurse.
* Legacy/deprecated sections (and everything under them) are skipped.
+ *
+ * A folder emits a heading one level deeper, and markdown headings do not
+ * close — so a plain page emitted after a folder reads as belonging to that
+ * folder. `meta.json` order is the human sidebar's order and cannot absorb
+ * this, so each section's direct pages are buffered and flushed ahead of its
+ * folders. Within pages, and within folders, `meta.json` order is preserved.
*/
function walkPageTree(nodes: TreeNode[], depth = 2): string {
const lines: string[] = [];
let skippingSection = false;
+ let sectionPages: string[] = [];
+ let sectionFolders: string[] = [];
+
+ function flushSection() {
+ lines.push(...sectionPages, ...sectionFolders);
+ sectionPages = [];
+ sectionFolders = [];
+ }
for (const node of nodes) {
if (node.type === 'separator') {
// A separator starts a new section; skip it and its pages when legacy.
+ flushSection();
skippingSection = isLegacySeparator(node.name);
if (skippingSection) continue;
const text = nodeText(node.name);
@@ -68,28 +83,30 @@ function walkPageTree(nodes: TreeNode[], depth = 2): string {
switch (node.type) {
case 'page':
- lines.push(`- https://docs.composio.dev${node.url}.md`);
+ sectionPages.push(`- https://docs.composio.dev${node.url}.md`);
break;
case 'folder': {
// Folders are sub-sections within separator sections, so one level deeper
const text = nodeText(node.name);
if (text) {
- lines.push('', `${'#'.repeat(depth + 1)} ${text}`, '');
+ sectionFolders.push('', `${'#'.repeat(depth + 1)} ${text}`, '');
}
// If folder has an index page, include it
if (node.index) {
- lines.push(`- https://docs.composio.dev${node.index.url}.md`);
+ sectionFolders.push(`- https://docs.composio.dev${node.index.url}.md`);
}
// Recurse into children
if (node.children.length > 0) {
- lines.push(walkPageTree(node.children, depth + 1));
+ sectionFolders.push(walkPageTree(node.children, depth + 1));
}
break;
}
}
}
+ flushSection();
+
return lines
.join('\n')
.replace(/\n{3,}/g, '\n\n')
diff --git a/docs/content/docs/authentication/meta.json b/docs/content/docs/authentication/meta.json
index 19c262892..f722666d1 100644
--- a/docs/content/docs/authentication/meta.json
+++ b/docs/content/docs/authentication/meta.json
@@ -1,7 +1,6 @@
{
"title": "Authentication",
"pages": [
- "index",
"manually-authenticating",
"managing-multiple-connected-accounts",
"importing-existing-connections",
diff --git a/docs/content/docs/meta.json b/docs/content/docs/meta.json
index 0e7498bc8..c99e005e4 100644
--- a/docs/content/docs/meta.json
+++ b/docs/content/docs/meta.json
@@ -24,7 +24,7 @@
"auth-configuration",
"---Migration---",
"migration-guide",
- "---Security and data---",
+ "---Security---",
"security"
]
}
diff --git a/docs/tests/static/navigation.test.ts b/docs/tests/static/navigation.test.ts
index 0aa3b16d6..1342bea5d 100644
--- a/docs/tests/static/navigation.test.ts
+++ b/docs/tests/static/navigation.test.ts
@@ -54,7 +54,7 @@ describe("Navigation - meta.json validity", () => {
"---Guides---",
"---Direct execution (legacy)---",
"---Migration---",
- "---Security and data---",
+ "---Security---",
]);
expect(pages.slice(1, pages.indexOf("---Core concepts---"))).toEqual([
diff --git a/docs/tests/static/start-routing.test.ts b/docs/tests/static/start-routing.test.ts
index ed434fbd2..4f1df3019 100644
--- a/docs/tests/static/start-routing.test.ts
+++ b/docs/tests/static/start-routing.test.ts
@@ -80,13 +80,19 @@ describe('getting-started routing policy', () => {
const { GET } = await import('../../app/llms.txt/route');
const llms = await (await GET()).text();
- for (const url of GUIDE_URLS) {
+ for (const url of ['/docs/authentication', ...GUIDE_URLS]) {
const occurrences = llms.split(`https://docs.composio.dev${url}.md`).length - 1;
expect(occurrences, `${url} appears ${occurrences}x in llms.txt`).toBe(1);
}
});
- test('files the authentication guides under Core concepts, not a trailing section', async () => {
+ /**
+ * `nearest` is the closest preceding heading of any level. Markdown headings
+ * do not close, so it is what an agent reads a URL as belonging to: a page
+ * emitted after a folder reads as one of that folder's children even though
+ * the sidebar shows it as a sibling.
+ */
+ test('files each page under the section it belongs to', async () => {
const { GET } = await import('../../app/llms.txt/route');
const lines = (await (await GET()).text()).split('\n');
@@ -94,21 +100,47 @@ describe('getting-started routing policy', () => {
const index = lines.findIndex(line => line.endsWith(`${url}.md`));
expect(index, `${url} missing from llms.txt`).toBeGreaterThan(-1);
const preceding = lines.slice(0, index);
- const last = (prefix: string) => preceding.findLast(line => line.startsWith(prefix));
- return [last('## '), last('### ')];
+ return {
+ section: preceding.findLast(line => line.startsWith('## ')),
+ nearest: preceding.findLast(line => line.startsWith('#')),
+ };
};
for (const guide of AUTH_GUIDES) {
- expect(sectionOf(`/docs/authentication/${guide}`)).toEqual([
- '## Core concepts',
- '### Authentication',
- ]);
+ expect(sectionOf(`/docs/authentication/${guide}`)).toEqual({
+ section: '## Core concepts',
+ nearest: '### Authentication',
+ });
+ }
+
+ expect(sectionOf('/docs/authentication')).toEqual({
+ section: '## Core concepts',
+ nearest: '### Authentication',
+ });
+
+ expect(sectionOf('/docs/extending-sessions/shared-connections')).toEqual({
+ section: '## Guides',
+ nearest: '### Extend sessions',
+ });
+
+ // Siblings that follow the Authentication folder in meta.json. These fell
+ // under `### Authentication` when folders were emitted in meta.json order.
+ for (const sibling of ['/docs/triggers', '/docs/skills']) {
+ expect(sectionOf(sibling)).toEqual({
+ section: '## Core concepts',
+ nearest: '## Core concepts',
+ });
+ }
+
+ // Same failure mode, pre-dating this folder: Get Started's pages sit after
+ // the `providers` folder and used to read as SDKs-and-frameworks children.
+ for (const sibling of ['/docs/agent-plugins', '/docs/cli', '/docs/composio-connect']) {
+ expect(sectionOf(sibling)).toEqual({
+ section: '## Get Started',
+ nearest: '## Get Started',
+ });
}
- expect(sectionOf('/docs/extending-sessions/shared-connections')).toEqual([
- '## Guides',
- '### Extend sessions',
- ]);
expect(lines).not.toContain('## Authentication guides');
});
});