3 min read · 606 words
We’ve all heard the holy grail of indie hacking: making money while you sleep. But let's be real—most "passive income" projects require active maintenance, bug fixing, and endless content creation.
Until recently, my side project—a niche technical newsletter and automated code-auditing service—was eating up my weekends. I spent hours curating updates, writing summaries, and generating custom feedback reports for users.
Then I decided to completely automate the pipeline using Python and the Anthropic API. Now, the system runs autonomously on a cron job, delivering value to subscribers and processing micro-payments without my intervention. Here is how I built it.
The Architecture
The system is straightforward:
- Data Ingestion: A script pulls the latest trending GitHub repositories and tech discussions.
-
AI Processing:
claude-opus-5analyzes the data, extracts key insights, and drafts personalized user reports. - Delivery & Monetization: The system sends out the newsletter and triggers Stripe invoices for premium audits.
Because we are working with heavy processing tasks that exceed standard token limits, we need to stream the response and leverage adaptive thinking for deep code analysis.
Step 1: Setting Up the AI Engine
First, install the latest Anthropic SDK:
pip install anthropic
Here is the core script that powers the automated analysis. Notice how we use claude-opus-5, enable adaptive thinking, and omit parameters like temperature which have been removed in the current API version:
import anthropic
client = anthropic.Anthropic()
def generate_nightly_report(raw_code_data: str) -> str:
response = client.messages.create(
model="claude-opus-5",
max_tokens=25000,
thinking={"type": "adaptive"},
output_config={"effort": "high"},
messages=[
{
"role": "user",
"content": (
"Analyze the following repository data and generate a concise, "
"high-value security audit and summary for our subscribers:\n\n"
f"{raw_code_data}"
)
}
]
)
# Extract the text content block from the response
return response.content[0].text
# Example execution
if __name__ == "__main__":
sample_data = "Repo: async-cache-tools | PR #42: Memory leak in worker pool cleanup."
report = generate_nightly_report(sample_data)
print("Generated Autonomous Report:")
print(report)
Step 2: Structured JSON Output for Database Storage
To make the automation fully hands-off, the reports need to be automatically categorized and saved to a database. Instead of relying on prompt engineering alone, we use output_config={"format": {...}} to guarantee a clean JSON payload.
Here is how we structure the output for our backend database:
import json
import anthropic
client = anthropic.Anthropic()
def generate_structured_audit(issue_description: str) -> dict:
response = client.messages.create(
model="claude-sonnet-5",
max_tokens=8000,
output_config={
"format": {
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"severity": {"type": "string", "enum": ["low", "medium", "high", "critical"]},
"summary": {"type": "string"},
"actionable_fix": {"type": "string"}
},
"required": ["severity", "summary", "actionable_fix"]
}
}
},
messages=[
{
"role": "user",
"content": f"Audit this bug report and return the required JSON schema: {issue_description}"
}
]
)
return json.loads(response.content[0].text)
# Example execution
if __name__ == "__main__":
bug = "Database connection pool exhausts under heavy concurrent load."
audit_json = generate_structured_audit(bug)
print(json.dumps(audit_json, indent=2))
Key Takeaways for Builders
-
Let Go of Legacy Parameters: Remember that
temperature,top_p, andtop_kare gone. Steer your model's creativity and focus entirely through clear, explicit prompt instructions and theoutput_config={"effort": ...}setting. -
Embrace Streaming for Large Outputs: When running deep analysis tasks with
claude-opus-5generating thousands of tokens, ensure your client handles streaming properly to avoid gateway timeouts. -
Reliability Over Prefilling: Assistant-turn prefilling is deprecated. Use strict JSON schemas via
output_configto enforce structured data types every single time.
By combining robust backend cron jobs with the raw analytical power of claude-opus-5 and claude-sonnet-5, my side project now runs like a well-oiled machine while I sleep.
Have you automated your side projects using AI yet? Drop a comment below or share what models you are deploying in production!
Top comments (0)