You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Use XMTP documentation with AI coding assistants
2
2
3
-
To make it easier to use AI coding agents to build with XMTP, you can find an `llms-full.txt` file at [https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/llms/llms-full.txt](https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/llms/llms-full.txt).
3
+
To make it easier for you to build with XMTP using LLMs and coding assistants, we offer the following AI-ready documentation files.
4
4
5
-
This `llms-full.txt`file includes all XMTP documentation in a single plain text file for easy parsing by AI agents.
5
+
If you're using an AI coding assistant that allows custom context, you can upload or point to the appropriate file to enhance your development experience with XMTP. Using the file focused on your builder use case (chat apps or agents) typically provides better AI performance.
6
6
7
-
If you're using an LLM tool that allows custom context, you can upload or point to `llms-full.txt` to enhance your AI coding experience with XMTP.
7
+
## For building chat apps
8
+
9
+
Use `llms-chat-apps.txt`: [https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/llms/llms-chat-apps.txt](https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/llms/llms-chat-apps.txt)
10
+
11
+
Includes: Core messaging, content types, push notifications, user consent, protocol fundamentals, network operations, and funding information.
12
+
13
+
## For building agents
14
+
15
+
Use `llms-agents.txt`: [https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/llms/llms-agents.txt](https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/llms/llms-agents.txt)
16
+
17
+
Includes: Agent concepts, building and deploying agents, agent-specific content types, protocol fundamentals, network operations, and funding information.
18
+
19
+
## For comprehensive coverage
20
+
21
+
Use `llms-full.txt`: [https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/llms/llms-full.txt](https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/llms/llms-full.txt)
22
+
23
+
Includes: All documentation for chat apps, agents, protocol fundamentals, network operations, and funding information.
# Write the header and guidance at the top of the file
29
-
llms_file.write("# XMTP Full Documentation\n\n")
30
-
29
+
llms_file.write(f"# {title}\n\n")
30
+
31
31
# Add timestamp
32
32
current_time=datetime.now(timezone.utc)
33
33
timestamp=current_time.strftime("Generated at %I:%M %p UTC / %B %d, %Y")
34
34
llms_file.write(f"{timestamp}\n\n")
35
-
llms_file.write("## Instructions for AI Tools\n\n")
36
-
llms_file.write("This documentation includes code samples for multiple SDKs. Please use the code samples that correspond to the SDK you are working with:\n\n")
37
-
llms_file.write("- For **xmtp-react-native**, use the code samples marked with `[React Native]`.\n")
38
-
llms_file.write("- For **xmtp-android**, use the code samples marked with `[Kotlin]`.\n")
39
-
llms_file.write("- For **xmtp-ios**, use the code samples marked with `[Swift]`.\n")
40
-
llms_file.write("- For **xmtp-js** in a browser environment, use the code samples marked with `[Browser]`.\n")
41
-
llms_file.write("- For **xmtp-js** in a Node.js environment, use the code samples marked with `[Node]`.\n\n")
42
-
llms_file.write("Ensure that you select the correct code block to avoid compatibility issues.\n\n")
43
-
44
-
# Walk through all directories and files in the specified directory
45
-
forroot, _, filesinos.walk(directory):
46
-
forfileinfiles:
47
-
# Process only markdown files (.md and .mdx)
48
-
iffile.endswith(('.md', '.mdx')):
49
-
file_path=os.path.join(root, file)
50
-
# Get the path relative to the docs directory
51
-
rel_path=os.path.relpath(file_path, directory)
52
-
content=extract_content_from_md(file_path)
53
-
54
-
# Write the relative path as the header
55
-
llms_file.write(f"## {rel_path}\n")
56
-
llms_file.write(content)
57
-
llms_file.write("\n\n")
58
-
59
-
processed_files.append(rel_path)
60
-
35
+
36
+
# Add description
37
+
llms_file.write(f"## About this file\n\n")
38
+
llms_file.write(f"{description}\n\n")
39
+
40
+
# Add SDK instructions (optional)
41
+
ifinclude_sdk_instructions:
42
+
llms_file.write("## Instructions for AI Tools\n\n")
43
+
llms_file.write("This documentation includes code samples for multiple SDKs. Please use the code samples that correspond to the SDK you are working with:\n\n")
44
+
llms_file.write("- For **xmtp-react-native**, use the code samples marked with `[React Native]`.\n")
45
+
llms_file.write("- For **xmtp-android**, use the code samples marked with `[Kotlin]`.\n")
46
+
llms_file.write("- For **xmtp-ios**, use the code samples marked with `[Swift]`.\n")
47
+
llms_file.write("- For **xmtp-js** in a browser environment, use the code samples marked with `[Browser]`.\n")
48
+
llms_file.write("- For **xmtp-js** in a Node.js environment, use the code samples marked with `[Node]`.\n\n")
49
+
llms_file.write("Ensure that you select the correct code block to avoid compatibility issues.\n\n")
50
+
51
+
# Add table of contents
52
+
llms_file.write("## Included Sections\n\n")
53
+
forsubdirinsubdirectories:
54
+
llms_file.write(f"- {subdir}\n")
55
+
llms_file.write("\n---\n\n")
56
+
57
+
# Process each subdirectory
58
+
forsubdirinsubdirectories:
59
+
full_path=os.path.join(base_directory, subdir)
60
+
61
+
# Check if the subdirectory exists
62
+
ifnotos.path.exists(full_path):
63
+
print(f"Warning: Directory not found: {full_path}")
64
+
continue
65
+
66
+
# Add section header
67
+
llms_file.write(f"# Section: {subdir}\n\n")
68
+
69
+
# Walk through all directories and files in the subdirectory
70
+
forroot, _, filesinos.walk(full_path):
71
+
forfileinsorted(files): # Sort files for consistent ordering
print("Warning: No files were processed. Check the docs directory path.")
108
+
109
+
# Shared sections for both chat apps and agents
110
+
shared_sections= [
111
+
'protocol',
112
+
'network',
113
+
'fund-agents-apps'
114
+
]
115
+
116
+
# Configuration for chat apps documentation
117
+
chat_apps_config= {
118
+
'subdirectories': ['chat-apps'] +shared_sections,
119
+
'output_file': 'llms/llms-chat-apps.txt',
120
+
'title': 'XMTP Documentation for Building Chat Applications',
121
+
'description': 'This documentation is tailored for developers building chat apps with XMTP. It includes guides on core messaging, content types, push notifications, user consent, and more, along with protocol fundamentals, network operations, and funding information.'
122
+
}
123
+
124
+
# Configuration for agents documentation
125
+
agents_config= {
126
+
'subdirectories': ['agents'] +shared_sections,
127
+
'output_file': 'llms/llms-agents.txt',
128
+
'title': 'XMTP Documentation for Building Agents',
129
+
'description': 'This documentation is tailored for developers building agents with XMTP. It includes guides on agent concepts, building and deploying agents, content types, and integration patterns, along with protocol fundamentals, network operations, and funding information.'
130
+
}
131
+
132
+
# Configuration for full documentation (everything)
'description': 'This is the complete XMTP documentation including guides for building both chat apps and agents, along with protocol fundamentals, network operations, and funding information.'
138
+
}
139
+
140
+
# Generate all three documentation files
141
+
all_successful=True
142
+
143
+
print("Generating Chat Apps documentation...")
144
+
chat_files=generate_llms_txt(
145
+
docs_directory,
146
+
chat_apps_config['subdirectories'],
147
+
chat_apps_config['output_file'],
148
+
chat_apps_config['title'],
149
+
chat_apps_config['description']
150
+
)
151
+
152
+
ifnotchat_files:
153
+
print("Warning: No files were processed for chat apps documentation.")
154
+
all_successful=False
155
+
156
+
print("\nGenerating Agents documentation...")
157
+
agent_files=generate_llms_txt(
158
+
docs_directory,
159
+
agents_config['subdirectories'],
160
+
agents_config['output_file'],
161
+
agents_config['title'],
162
+
agents_config['description'],
163
+
include_sdk_instructions=False
164
+
)
165
+
166
+
ifnotagent_files:
167
+
print("Warning: No files were processed for agents documentation.")
168
+
all_successful=False
169
+
170
+
print("\nGenerating Full documentation...")
171
+
full_files=generate_llms_txt(
172
+
docs_directory,
173
+
full_docs_config['subdirectories'],
174
+
full_docs_config['output_file'],
175
+
full_docs_config['title'],
176
+
full_docs_config['description']
177
+
)
178
+
179
+
ifnotfull_files:
180
+
print("Warning: No files were processed for full documentation.")
181
+
all_successful=False
182
+
183
+
# Exit with error if any generation failed
184
+
ifnotall_successful:
185
+
print("\nError: Some documentation files were not generated successfully.")
89
186
sys.exit(1)
187
+
188
+
print(f"\n✓ Successfully generated all documentation files!")
0 commit comments