Skip to content

Instantly share code, notes, and snippets.

View sanurb's full-sized avatar
🏠
Working from home

Santiago U sanurb

🏠
Working from home
View GitHub Profile
@sanurb
sanurb / pi-fff-spec.md
Created April 5, 2026 18:41
pi-fff Specification — FFF-powered search extension for Pi

pi-fff Specification

A Pi extension that replaces the built-in find and grep tools with FFF — a Rust search engine called through the Node SDK (@ff-labs/fff-node) via C FFI. No subprocess per call. Pre-indexed filesystem. Frecency-ranked results. Git-aware. Adds multi_grep for OR-logic multi-pattern search.

The extension's value is not in calling FFF. It is in what happens between the raw FFF result and the text the agent sees. The output formatter, fallback engine, and auto-enrichment logic are where the token savings come from.

1. What This Replaces and Why

Pi's built-in tools spawn fd (find) and rg (grep) as subprocesses. Every call starts from scratch — no index, no ranking, no memory of previous searches. Results come back as flat text sorted by filesystem order.

@sanurb
sanurb / shiro-compiler-spec.md
Last active April 5, 2026 03:38
Shiro Compiler Service Specification — TypeScript CLI for enrichment, wiki generation, and linting over Shiro's canonical store

Shiro Compiler — Pi Extension Specification

Status: Draft v2 Purpose: Define a Pi extension that enriches Shiro's canonical store with LLM-extracted annotations and generates a human-browsable wiki from the enriched knowledge base.

1. Problem Statement

Shiro is a local-first knowledge engine: canonical documents in SQLite, hybrid retrieval, trust zones designed in ADRs but unimplemented. It is deliberately LLM-free and deterministic.

The compiler is the enrichment and compilation layer that sits between Shiro and the human reader. It solves three problems:

#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
EMAIL="you@example.com"
NAME="Your Name"
KEY_FILE="${HOME}/.ssh/id_ed25519"
COLOR_OFF=""
@sanurb
sanurb / webpage-clone.js
Created September 24, 2024 05:54
Just go to the website you want to clone and paste the script
(async function downloadCompleteHTML() {
// Fetch a resource as text or data URL
async function fetchResource(url, responseType = 'text') {
try {
const response = await fetch(url, { mode: 'cors' });
if (!response.ok) throw new Error(`Failed to fetch resource: ${url}`);
if (responseType === 'dataURL') {
const blob = await response.blob();
return await blobToDataURL(blob);
} else {
{
// Based on:
// https://github.com/r5n-dev/vscode-react-javascript-snippets/blob/master/src/snippets/generated.json
// modernizing it to align with the latest React best practices (as of 2025).
// - Importing `React` is no longer required for components, simplifying the structure.
"exportType": {
"body": [
"export type ${1:first} = {${2:second}}"
],
"key": "exportType",