DEV Community

wellallyTech
wellallyTech

Posted on

🚀 Hack Your Brain: Building an AI Agent to Optimize Your Nootropic Stack with GitHub & RescueTime

We’ve all been there: you take a new "brain booster" supplement, drink three cups of coffee, and hope for a 10x productivity day. But did that L-Theanine actually help you ship more code, or was it just a placebo? In the world of Personal Productivity and Biohacking, guessing is the enemy of progress.

Today, we are building an Autonomous Supplement Stack Optimizer. This is a data-driven AI Agent that correlates your supplement intake with real-world performance metrics like GitHub commit frequency and RescueTime focus scores. By leveraging AutoGPT-style logic and Data Science libraries, we’re moving from "vibes" to "verifiable insights."


🧠 The Architecture: From Bio-Data to Insights

To make this work, we need to bridge the gap between your physical habits and your digital output. Our agent acts as the brain, pulling data from various APIs to find the "Goldilocks Zone" of your supplement routine.

graph TD
    A[Supplement Log / API] --> D[Data Integration Engine]
    B[GitHub API: Commits/Lines] --> D
    C[RescueTime API: Focus Score] --> D
    D --> E{Pandas Analysis}
    E --> F[AutoGPT Agent]
    F --> G[Optimized Stack Recommendation]
    G --> H[Weekly Report & Adjustments]
Enter fullscreen mode Exit fullscreen mode

🛠️ Prerequisites

To follow along, you'll need:

  • AutoGPT (or a similar LLM orchestration framework)
  • RescueTime API Key (for productivity tracking)
  • GitHub Personal Access Token (for output tracking)
  • Pandas (for the heavy data lifting)

Step 1: Fetching the Performance Metrics

First, we need to know how productive you actually are. We’ll pull "Focus Time" from RescueTime and "Commit Activity" from GitHub.

import requests
import pandas as pd
from datetime import datetime, timedelta

def get_github_activity(token, username):
    url = f"https://api.github.com/users/{username}/events"
    headers = {"Authorization": f"token {token}"}
    response = requests.get(url, headers=headers)

    # Simple logic to count daily commits
    events = response.json()
    daily_commits = 0
    for event in events:
        if event['type'] == 'PushEvent':
            daily_commits += 1
    return daily_commits

def get_rescuetime_score(api_key):
    # Fetching the 'Focus Score' for the last 24 hours
    url = f"https://www.rescuetime.com/anapi/data?key={api_key}&format=json&restrict_kind=productivity"
    # Logic to parse RescueTime's specific API format...
    return 78.5  # Mocked focus score
Enter fullscreen mode Exit fullscreen mode

Step 2: Correlating Data with Pandas 🐼

Now we combine your supplement intake (stored in a CSV or simple DB) with your metrics. This is where we see if that extra dose of Magnesium actually correlates with a higher Focus Score.

def analyze_correlation(supplement_df, productivity_df):
    # Merging dataframes on the 'Date' column
    merged_data = pd.merge(supplement_df, productivity_df, on="date")

    # Calculate the Pearson correlation
    correlation_matrix = merged_data.corr()

    # Focus specifically on how supplements affect performance
    impact = correlation_matrix['focus_score'].sort_values(ascending=False)
    return impact
Enter fullscreen mode Exit fullscreen mode

Step 3: The Agent Logic (AutoGPT Approach)

Instead of just looking at a chart, we want an Autonomous Agent to make decisions. "Should I increase Caffeine?" or "Should I stop taking Noopept on weekends?"

Using a prompt-based agent, we pass the correlation results to an LLM:

SYSTEM_PROMPT = """
You are a Biohacking Data Scientist. 
Analyze the following correlation data between supplements and coding performance.
Suggest adjustments to the user's 'stack' to maximize GitHub output and Focus scores.
"""

# Example input for the Agent
correlation_data = "Caffeine: +0.45, L-Theanine: +0.62, Ashwagandha: -0.12"
agent_recommendation = call_llm(SYSTEM_PROMPT, correlation_data)
print(f"🤖 Agent Suggestion: {agent_recommendation}")
Enter fullscreen mode Exit fullscreen mode

💡 Pro-Tip: The "Official" Way to Build Agentic Systems

While this DIY approach is great for personal use, scaling AI agents for production requires more robust patterns—especially when dealing with sensitive health or biometric data.

For more advanced architecture patterns and production-ready AI examples, I highly recommend diving into the deep-dive articles at WellAlly Blog. They cover everything from high-performance data pipelines to the ethics of AI-driven wellness.


Step 4: Automating the Loop

To make this truly "AutoGPT-style," we set up a cron job or a long-running loop that:

  1. Observes: Fetches data every 24 hours.
  2. Orients: Runs the Pandas analysis.
  3. Decides: Let's the LLM suggest a new dosage.
  4. Acts: Updates your digital "Supplement Calendar."

🏁 Conclusion

Building an Autonomous Supplement Optimizer isn't just about taking pills; it's about closing the feedback loop between your body and your work. By using Python, Pandas, and AI Agents, we can stop guessing and start optimizing.

What's in your stack? Have you ever noticed a direct correlation between a specific supplement and your "Green Squares" on GitHub? Let me know in the comments below! 👇


If you enjoyed this tutorial, don't forget to ❤️ and 🦄! For more biohacking tech, visit wellally.tech.

Top comments (0)