Skip to content

Instantly share code, notes, and snippets.

View vegarsti's full-sized avatar

Vegard Stikbakke vegarsti

View GitHub Profile
#include <sys/event.h>
#include <sys/time.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// Watches files for changes and prints which file changed
int main(int argc, char *argv[]) {
if (argc < 2) {
@vegarsti
vegarsti / files.md
Created March 24, 2026 09:29
Elwing S3 file storage analysis & garden files plan

S3 File Storage: Current State & Plan

Where files are stored in S3

All files go to the lefos-conversations-dev bucket (config: CONVERSATION_BUCKET), with one shared S3 client at packages/elwing/src/s3/client.ts.

S3 key hierarchy:

{domainId}/{mailboxId}/{conversationId}/
├── artifacts/{filename} # Agent-produced files

Elwing Billing System — Data Flow Summary

Elwing uses Polar (polar.sh) as its billing/subscription provider. Billing is credit-based: users purchase subscriptions or top-ups via Polar, receive credits, and credits are consumed as the AI agent processes emails, chats, and memory operations.

Key Concepts

Concept Description
Credits Internal currency. Converted from token cost: credits = tokenCents × 12.5
Billing Owner Each space has one billing owner (user). All charges in that space bill to them.
@vegarsti
vegarsti / session-storage-record-examples.md
Created March 16, 2026 10:30
RFC 0005: Unified Session Storage — concrete record examples per trigger type

Session Storage Record Examples

Each example shows the concrete conversation_records rows written per trigger type. All examples use conv_ABC as the conversation ID.


Common: Session Root

Written once per conversation (lazily, on first trigger). All subsequent main-thread

@vegarsti
vegarsti / session_plan.md
Last active March 13, 2026 13:40
Elwing: Session state migration plan

Session State Migration Plan

Move all session state out of Absurd checkpoint tables into our own database, enabling conversation replay and forking from conversation_records + a new session table.

Phase 1 — Refactors (no DB changes)

1a. Move DB recording inside ctx.step

https://twitter.com/thorstenball/status/1576619567488475137?s=20&t=KaBdUrc5-M1bnNTMU6tuQA
Working with Unix Processes
Working with TCP Sockets
Working with Ruby Threads
Zed Shaw's C book
Programming From The Ground Up
Destroy All Software
PeepCode Play by Play
Pragmatic Programmer
Install Karabiner Elements.
Follow this
https://github.com/tekezo/Karabiner-Elements/issues/638
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/vegard/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="sobole"