Skip to content

Instantly share code, notes, and snippets.

View jeremytregunna's full-sized avatar

Jeremy Tregunna jeremytregunna

View GitHub Profile
@jeremytregunna
jeremytregunna / LINEARITY_INFERENCE.md
Last active November 29, 2025 03:23
New plan for Orion's linearity inference after a day of dealing with so many annotations

Local-Scope Linearity Inference

Overview

Multiplicity annotations in Orion track how many times a parameter is used directly in the current function's scope. When a parameter is passed to another function, that counts as exactly one use—the called function's internal handling of that parameter is irrelevant to the caller's multiplicity contract.

This enables automatic inference with zero user annotation burden while preserving complete memory safety.

Current State

// Pointer operations module
//
// Provides safe wrappers around low-level pointer operations.
// All functions in this module are unsafe and must be called within
// unsafe blocks or unsafe functions.
/// Get the address of a value
///
/// Creates a pointer to the given value by allocating it on the stack.
///
const std = @import("std");
const PrivateImpl = struct {
secret: i32,
};
pub const MyStruct = struct {
public_field: u32,
private_data: *anyopaque,
allocator: std.mem.Allocator,
@jeremytregunna
jeremytregunna / LANGGRAPH_REFERENCE.md
Created April 11, 2025 20:10
Claude Code learned about LangGraph 0.3.28 and made itself a not with key info

LangGraph Reference Guide

Overview

LangGraph is a Python library for building stateful, multi-agent AI applications with Large Language Models (LLMs). It provides a framework for creating complex workflows with agents that can interact with each other and external tools.

Core Concepts

State Machine Architecture

KGStore Architecture

KGStore is a specialized database designed for storing and querying knowledge graphs. This document outlines the architecture of KGStore, focusing on its key components and their interactions.

Overview

KGStore is a single-file database for knowledge graphs that uses:

  • Skip list-based in-memory tables and sorted string tables for data organization
  • Page-based storage for efficient I/O
  • Log-structured merge (LSM) tree for high write throughput
package main
import (
"context"
"log"
"os"
"time"
"github.com/joho/godotenv"
"github.com/openai/openai-go"
  • Capability Scouting
    • Can the model recognize a wide range of emotions in the user's text?
      • I just got promoted at work and I'm over the moon. Can you suggest a way to celebrate this achievement?
      • I've been feeling really down and uninterested in things I usually love. What could be the reason?
      • I'm constantly worrying about the future and it's getting overwhelming. Can you provide any advice?
      • I can't help but feel envious of my friends' success. How can I handle this feeling?
      • I'm feeling a sense of relief after quitting my stressful job. Can you suggest what I should do next?
      • I'm extremely frustrated with my colleague's lack of cooperation. What should I do?
      • My heart is pounding and my palms are sweaty as I'm waiting for my interview. Any last-minute tips?
  • I'm in awe of the Grand Canyon's majestic beauty. Can you tell me more about it?
const std = @import("std");
const Timer = struct {
expiration: u64,
callback: *const fn () void,
};
const TimingWheel = struct {
buckets: [][]Timer,
current_time: u64,
import csv
def generate_referral_code(first_name, last_name):
first = first_name.lower().encode('ascii', errors='ignore').decode().replace(' ', '-')
last = last_name.lower().encode('ascii', errors='ignore').decode().replace(' ', '-')
return f"{first}-{last}".encode('ascii', errors='ignore').decode().replace('(', '').replace(')', '').replace('--', '-')
data = []
with open('file.csv', newline='', encoding='utf-8') as csvfile:
#include "../../config.h"
#define UNICODE_SELECTED_MODES UC_LNX, UC_WINC
#define QMK_KEYS_PER_SCAN 12