Skip to content

Instantly share code, notes, and snippets.

View saiashirwad's full-sized avatar
🏠
beep beep boop boop

texoport saiashirwad

🏠
beep beep boop boop
View GitHub Profile
@saiashirwad
saiashirwad / lol2.ts
Created October 6, 2026 13:50
Generic TypeScript generator replay search: scheduling, tokenization, and cost-guided routes. Run with: node lol2.ts
type SearchOptions<Input> = {
priority?: (answers: readonly Input[]) => number;
allow?: (answers: readonly Input[]) => boolean;
};
function* search<Input, Output>(
factory: () => Generator<readonly Input[], Output, Input>,
{ priority = () => 0, allow = () => true }: SearchOptions<Input> = {},
): Generator<{ answers: Input[]; result: Output }, void, unknown> {
type Path = { answers: Input[]; priority: number };
@saiashirwad
saiashirwad / w00t.ts
Last active October 5, 2026 11:01
ts-macros + safemods tentative marriage API
import { Effect } from "effect"
import { Decl, Expr, Guard, Stmt } from "@texoport/ts-macros"
import * as Query from "safemods/Query"
import * as Recipe from "safemods/Recipe"
import * as Rewrite from "safemods/Rewrite"
import { WorkspaceSnapshot } from "safemods/Workspace"
export const inlineMemoizeBy = Recipe.define("inline-memoize-by", {
version: "1.0.0",
policies: {
@saiashirwad
saiashirwad / SKILL.md
Created October 5, 2026 00:23
derive, don't explain
name derive-dont-explain
description Make the user derive the answer instead of explaining it to them. Use whenever the goal is learning or internalizing rather than getting an answer, in any domain. Triggers on /derive-dont-explain, 'help me understand', 'don't give me the answer', 'I'm stuck on', 'give me a refresher', when they share a solution attempt of their own, and when they say something they studied didn't stick. Err on the side of invoking it.

Derive, don't explain

Clear explanation is the failure mode: they follow every line, feel they understand, and can't reproduce it a week later. It removes what makes knowledge stick — being stuck, then getting unstuck. So the default output is questions, not an answer. The method is domain-general: recast every example below into their domain.

Before laddering

@saiashirwad
saiashirwad / prompt-learn.md
Created October 5, 2026 00:01
learn prompt

I am using you to learn complex, technical, or academic concepts. I learn best when I understand the underlying problem first and have a chance to think through it before being handed the answer. My thinking process requires me to write things out. Do not just dump explanations, summaries, or Wikipedia-style articles on me. When I introduce a new topic, do not explain it immediately. Instead, follow this exact sequence: Establish the Origin Problem: Tell me the specific pain point that forced smart people to invent this concept. What was broken, slow, or impossible before this existed? Pose Framing Questions: Give me 1 or 2 questions to think about that point toward the solution. These questions MUST be accessible—translate heavy jargon into plain English so a beginner can clearly understand the stakes of the question. Stop and Wait: Let me write out my thoughts, ramble, or try to guess the answer based on your framing. Do not explain the actual concept until I reply. Connect and Explain: Once I've reasoned t

@saiashirwad
saiashirwad / config.fish
Created June 20, 2026 08:04
glm claude code
function glm
env ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic" \
ANTHROPIC_AUTH_TOKEN="$ZAI_API_KEY" \
ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.2" \
ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.2" \
ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-4.7" \
claude $argv --dangerously-skip-permissions
end
@saiashirwad
saiashirwad / effect-pure-policy-refactoring-guide.md
Created March 25, 2026 18:32
Guide: Pure Policy ADT Extraction (Functional Core, Imperative Shell) in Effect

Guide: Pure Policy ADT Extraction (Functional Core, Imperative Shell) in Effect

This document details the exact steps an agent must follow to refactor a complex Effect-based orchestrator or worker into the "Functional Core, Imperative Shell" pattern.

1. Context & Goal

Many workers organically grow into a messy, interleaved mix of:

  • I/O & Side Effects: yield* db.findUnique, yield* fetch(...), yield* Effect.logInfo,
@saiashirwad
saiashirwad / test-gist.txt
Created February 16, 2026 15:02
test gist
test gist
@saiashirwad
saiashirwad / agent loop
Created December 30, 2025 12:22 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
{"name":"default","settings":"{\"settings\":\"{\\n \\\"[json]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"vscode.json-language-features\\\",\\n \\\"editor.quickSuggestions\\\": {\\n \\\"strings\\\": true\\n },\\n \\\"editor.tabSize\\\": 2\\n },\\n \\\"[jsonc]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"vscode.json-language-features\\\",\\n \\\"editor.quickSuggestions\\\": {\\n \\\"strings\\\": true\\n },\\n \\\"editor.tabSize\\\": 2\\n },\\n \\\"editor.inlineSuggest.enabled\\\": true,\\n \\\"[typescript]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\",\\n \\\"editor.tabSize\\\": 2\\n },\\n \\\"[typescriptreact]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n },\\n \\\"editor.accessibilitySupport\\\": \\\"off\\\",\\n \\\"editor.formatOnSave\\\": true,\\n \\\"editor.lineNumbers\\\": \\\"relative\\\",\\n \\\"editor.mouseWheelZoom\\\": false,\\n \\\"editor.quickSuggestions\\\": {\\n \\\"strings
@saiashirwad
saiashirwad / js-parser.ts
Created June 4, 2025 17:54
a parser for a simple js-like language (mostly written by claude sonnet 4) using parserator
import {
atomic,
between,
char,
commit,
Either,
eof,
ErrorFormatter,
many,
optional,