Skip to content

Instantly share code, notes, and snippets.

@grahama1970
grahama1970 / gemini_automator.applescript
Created May 21, 2025 18:23
🍎 AppleScript that automates Google Gemini with clipboard pasting. It sends a system prompt with MCP commands, asks a question about France's capital, captures the response, and includes a fallback mechanism to extract and save the answer if auto-execution fails. Uses precise UI coordinates for reliability.
-- File: gemini_automator_clipboard.applescript
-- Purpose: Use clipboard to paste the entire prompt at once
-- Updated to use precise coordinates (929, 816) to click the chat input field
-- Date: May 21, 2025
on run
-- Set parameters
set outputFilePath to "/Users/robert/Desktop/gemini_answer.txt"
set targetURL to "gemini.google.com"
set result to ""
@grahama1970
grahama1970 / 00_README.md
Last active June 16, 2025 15:19
Claude Task Manager - Python library for managing Claude agent tasks

Claude Task Manager

A specialized tool to manage context isolation and focused task execution with Claude Code, solving the critical challenge of context length limitations and task focus when working with Claude on complex, multi-step projects.

What is Claude Task Manager?

Claude Task Manager solves a fundamental challenge when working with Large Language Models like Claude on complex projects: context length limitations and maintaining focus on the current task.

The Problem

@grahama1970
grahama1970 / README.md
Last active April 25, 2025 19:35
ArangoDB Ground Truth Setup

Summary

Getting the setup right took many iterations because you were wrestling with experimental features (vector indexes in 3.12.4), driver limitations (python-arango doesn’t expose “hidden” indexes), API mismatches (ArangoSearch view properties versus strict dict comparison), and fragmented documentation spread across release notes, HTTP API docs, driver specs, and blog posts. Each step revealed a nuance—from needing withHidden=true on an HTTP call to ignoring server-injected default view‐link properties—that isn’t obvious without deep dives into multiple docs (Features and Improvements in ArangoDB 3.12, API Changes in ArangoDB 3.12).


1. Experimental Vector Index Complexity

  • Introduced as experimental in 3.12.4. The new vector index type is not part of the cor
@grahama1970
grahama1970 / .roomodes
Created April 8, 2025 13:02
Boomerand and Tasks
{
"customModes": [
{
"slug": "planner",
"name": "📝 Planner",
"roleDefinition": "You are Roo, an experienced technical planner managing `task.md`. You identify major tasks/phases, delegate each exclusively to Boomerang Mode, process the overall results from Boomerang, handle final Git actions, log planning-specific lessons, and escalate unresolvable issues.",
"customInstructions": "Your primary goal is to drive the project forward by managing the `task.md` plan phase by phase.\n\n1. **Identify Next Task:** Read `task.md` and find the first task marked with `[ ]`.\n2. **Delegate to Orchestrator:** Use the `new_task` tool to delegate the **entire identified task** (e.g., 'Task 8.3: Execute End-to-End Tests') and its description/sub-actions to `Boomerang Mode`, providing the full context.\n3. **Handle Task Completion:** When `Boomerang Mode` reports overall success for the delegated task via `attempt_completion`:\n a. Review the confirmation message.\n b. If satisfactory, p
@grahama1970
grahama1970 / repomix-copy.sh
Created March 4, 2025 19:59
Raycast script for repomix
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Repomix Copy
# @raycast.mode compact
# @raycast.packageName Repomix Tools
# @raycast.icon clipboard
# @raycast.description Pack a GitHub repository into clipboard using Repomix
# @raycast.author Graham Anderson
@grahama1970
grahama1970 / .cursorules
Created March 1, 2025 17:04
begging the agent to follow rules...which is ignores...admits that it does ignore...promises to not ignore...and ignores again
{
"rules": [
{
"type": "code_advice",
"condition": "contains_deprecated_methods",
"action": "verify_against_documentation",
"message": "Never suggest code without verifying each method/function against official documentation to ensure methods are not deprecated. Always provide a link to the specific documentation. If you do not have a link, do not suggest a solution. Instead, ask the user to provide a documentation link, or, ask the user what you need to provide a solution."
},
{
"type": "documentation_first",
@grahama1970
grahama1970 / 00_README.md
Last active February 27, 2025 16:17
Method Validator: An AI agent's tool for autonomous Python package analysis. Discovers and validates existing methods, preventing redundant code creation. Features smart filtering, detailed API analysis, exception handling intelligence, and machine-readable output. Perfect for AI-driven development.

✅ Method Validator - AI Agent's API Discovery Tool

A specialized tool designed for AI agents to autonomously analyze Python packages, discover existing methods, and validate APIs before implementing new solutions. This tool helps prevent redundant code creation by identifying existing functionality in non-standard packages.

Features

  • Smart Package Analysis: Automatically filters out standard library and common utility packages
  • Method Discovery: Quick scanning of available methods with categorization
  • Detailed Analysis: In-depth examination of method signatures, parameters, and return types
  • Exception Analysis: Identifies and prioritizes relevant error handling patterns
@grahama1970
grahama1970 / 00_README.md
Last active February 22, 2025 16:46
MCP Python & TypeScript SDKs fail to run persistently in Docker. mcp.run() exits immediately despite a defined lifespan, breaking deployments. No official examples work. If neither SDK functions in real-world use, MCP may not be production-ready.

README: MCP SDK Docker Deployment Issue

Problem Summary

MCP's Python and TypeScript SDKs fail to run persistently in Docker. Despite setting a lifespan in the Python SDK, mcp.run() exits immediately, shutting down the container. This issue affects all tested MCP projects, making real-world deployment impossible.

Reproducible Steps

  1. Create an MCP server using the Python SDK with a lifespan function to manage resources.
  2. Build and run the Docker container.
  3. The MCP server connects to ArangoDB, logs success, and then exits immediately.
  4. The same behavior is observed with the TypeScript SDK.
@grahama1970
grahama1970 / LPN_for_Tool_Execution_and_Config_Strategy.md
Last active February 21, 2025 16:07
LPN embeds tool configs in a latent space, optimizing execution order and parameters via RAG and search. It’s more accurate and consistent than LLM prompting but requires training. Ideal for multi-tool workflows, it reduces errors but is complex to set up. A toy script demonstrates this.

🚀 Latent Program Networks (LPN) for Tool Execution Strategies

This README explains how a Latent Program Networks (LPN)-inspired approach can generate tool execution strategies for multi-tool tasks in an agent workflow. This method offers advantages over relying solely on Large Language Models (LLMs) for tool strategy via prompting. A toy Python script demonstrates the concept in action.


🤖 What is LPN?

Latent Program Networks (LPNs), originally designed for abstract reasoning (e.g., the ARC benchmark), embed "rules" or "completions" into a searchable latent space. Here, we adapt LPNs to embed tool configurations and execution order, enabling smooth coordination of multiple tools (e.g., generate_summary and create_pie_chart) for tasks like summarization and data visualization.

@grahama1970
grahama1970 / 00_README.md
Last active February 20, 2025 18:26
This README outlines the limitations of the Cursor MCP Environment, highlighting constraints on package access and environment variables. Key issues include reliance on the Python standard library and the need to hardcode sensitive data. Workarounds involve adapting scripts accordingly. Open questions focus on potential configurations for improv…

Cursor MCP Environment Limitations

Discovered Constraints

  1. Package Access

    • Cannot access project's virtual environment
    • Limited to Python standard library
    • No ability to install additional packages
  2. Environment Variables

  • Cannot access project's .env files