A fast, simple REST API for AI agents to interact with the AI Archives system. This solution eliminates the Python environment hassles, reduces tool call overhead, and makes it easy for AI agents to search, read, and update archives.
- Simple HTTP API: No environment activation or complex command line arguments needed
- AI-Optimized Responses: Formatted specifically for AI agent consumption
- Fast Search: Quick access to archives content
- Custom Rules Management: Easy updating and regeneration of custom rules
- Multiple Access Methods: REST API, Python client library, or simplified command-line wrapper
pip install -r requirements-api.txtpython ai_archives.py serverThe server will start on http://localhost:5000 by default.
You can interact with the API in three ways:
# Search archives
curl "http://localhost:5000/search?query=authentication"
# Add to archives
curl -X POST http://localhost:5000/add \
-H "Content-Type: application/json" \
-d '{"project":"frontend", "section":"errors", "content":"Error message", "title":"Error Title"}'from archives_client import ArchivesClient
client = ArchivesClient()
# Search archives
results = client.quick_search("authentication", format_type="text")
print(results)
# Add to archives
client.add("frontend", "errors", "Error message", "Error Title")# Search archives
python ai_archives.py search "authentication"
# Add to archives
python ai_archives.py add frontend errors "Error message" "Error Title"
# List all projects
python ai_archives.py projects
# Update a rule
python ai_archives.py rule-add custom_rule "# Custom Rule Content"
# Generate cursorrules
python ai_archives.py generateGET /search?query=<query>&project=<project>GET /quick-search?query=<query>&project=<project>&format=<format>
POST /add(JSON body: project, section, content, title)
GET /rulesPOST /rules(JSON body: name, content)POST /generate-cursorrules(JSON body: output_path)
GET /list-projectsGET /list-sections?project=<project>
When using this system from an AI agent, follow these simple steps:
-
First, start the server (only needed once):
python ai_archives.py server
-
Then, use the client wrapper for all operations:
# For searching python ai_archives.py search "your search query" # For adding content (only when explicitly requested by user) python ai_archives.py add frontend errors "Error message" "Error Title"
This approach is much simpler and faster than the previous method using the Python virtual environment.