Skip to content

Instantly share code, notes, and snippets.

@monotykamary
monotykamary / letta-code-memory-architecture.md
Last active December 18, 2025 15:43
Letta Code Memory Architecture Deep Dive - Comprehensive technical breakdown of how memory works in Letta Code
@monotykamary
monotykamary / CONTEXT_OPTIMIZATION_GUIDE.md
Last active December 10, 2025 08:45
Playwright MCP Context Optimization Guide - Reduce action tool responses by 86-100% with real measurements

Playwright MCP Context Optimization Guide

This document describes how to reduce context overflow when using Playwright MCP with LLMs. A single tool call can produce 400k+ tokens due to ads, trackers, cookie banners, and verbose page snapshots. These optimizations can reduce that by 80-90%.

Problem Statement

Playwright MCP returns full page snapshots (accessibility tree in YAML format) after every action. This causes:

  • Token overflow: 400k+ tokens per tool call on complex pages
  • Wasted context: Ads, trackers, cookie banners inflate content
  • Unnecessary data: Most actions don't need the resulting snapshot
@monotykamary
monotykamary / centroids.md
Last active November 25, 2025 12:22
Semantic centroids

Formal Definition: Hybrid Semantic-Dimensional Similarity

1. Preliminaries: The Embedding Space

Let $\mathcal{T}$ be the set of all possible text inputs. We define a pre-trained embedding function $E$ that maps text to a $d$-dimensional vector space $\mathbb{R}^d$.

$$ E: \mathcal{T} \to \mathbb{R}^d $$

For any text input $x \in \mathcal{T}$, its vector representation is $\mathbf{v}_x = E(x)$. We assume the standard measure of semantic distance in this space is Cosine Similarity.

@monotykamary
monotykamary / event_store.ex
Created July 24, 2025 15:42
Event Store - Disk-based Event Storage System
defmodule EventStore do
@moduledoc """
- Resilient disk_log handling with automatic repair
- Batch writing for better performance
- Automatic log file maintenance
- Monitoring and metrics
- Quick recovery after crashes
"""
use GenServer
@monotykamary
monotykamary / .envrc
Last active June 30, 2025 13:04
Calling devpod binaries as if they were on your machine
#!/usr/bin/env bash
# Requires direnv: https://direnv.net/
# Check if this is a devcontainer project
if [[ ! -f .devcontainer/devcontainer.json ]] && [[ ! -f devcontainer.json ]]; then
return # Not a devcontainer project, do nothing
fi
if ! command -v devpod >/dev/null 2>&1; then
return # devpod not available, do nothing
@monotykamary
monotykamary / contemplative-llms-v2.txt
Created January 25, 2025 18:53
A variation of "Comtemplative Reasoning" with coverage for misguided attention
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@monotykamary
monotykamary / types.ex
Created January 4, 2025 20:15
MCP Schema as a TypedStruct in Elixir
defmodule MCP.Types do
@moduledoc """
Core types for the Model Context Protocol (MCP).
"""
use TypedStruct
defmodule RequestId do
@type t :: String.t() | integer()
end
@monotykamary
monotykamary / beamScheduler.ts
Created January 4, 2025 10:57
BEAM-inspired scheduler in RxJS
import { Observable, Scheduler } from 'rxjs';
import { Subscription } from 'rxjs';
import { Action } from 'rxjs/internal/scheduler/Action';
export function arrRemove<T>(arr: T[] | undefined | null, item: T) {
if (arr) {
const index = arr.indexOf(item);
0 <= index && arr.splice(index, 1);
}
}
@monotykamary
monotykamary / .vscode.css
Last active January 7, 2025 08:00
Custom VSCode CSS with Ayu Mirage
/* Main font family customization for core UI elements */
.monaco-workbench *:not(.codicon) {
font-family: 'IBM Plex Mono', monospace !important;
}
/* Set specific font size for list elements */
.monaco-list-row,
.monaco-list-rows {
font-size: 12px;
}
@monotykamary
monotykamary / nmap.go
Created December 31, 2024 09:02
nmap with Golang
package main
import (
"context"
"fmt"
"log"
"time"
"internal/config"