Skip to content

Instantly share code, notes, and snippets.

View lucidfrontier45's full-sized avatar

杜世橋 Du Shiqiao lucidfrontier45

  • GROUND Inc.
  • Tochigi, Japan
  • 03:04 (UTC +09:00)
View GitHub Profile
@lucidfrontier45
lucidfrontier45 / pi-extensions.json
Created October 12, 2026 02:56
My installed Pi extensions
[
"npm:@taterdoge/pi-ayu",
"npm:pi-opencode-theme",
"npm:@ff-labs/pi-fff",
"npm:pi-rewind",
"npm:@pi-lab/input-history",
"npm:pi-context-view",
"npm:@hk_net/pi-timestamp",
"npm:@calesennett/pi-codex-usage",
"npm:@howaboua/pi-codex-conversion",
@lucidfrontier45
lucidfrontier45 / README.md
Created October 11, 2026 14:23
Command Code mod: live status line (model, tok/s, ctx %, token totals). Persists per-session token counts to ~/.commandcode/token_count.db via node:sqlite (SQLite3) so counts survive restarts. See README.md in the gist for the full explanation.

my-statusline.ts — Command Code status line mod

This mod is a live status line for Command Code's UI — it renders a persistent single line showing which model is running, how fast it's generating, how full the context window is, and cumulative token spend.

What it displays (line()):

model/effort  │  12.4 tok/s  │  ctx 34% (68k/200k)  │  i 18.9k · c 72.9k · o 741

— model name (plus reasoning effort if set), generation speed, context usage as a percentage of the model's window (with humanized used/limit), and session totals for uncached input (i), cache reads (c), and output (o).

@lucidfrontier45
lucidfrontier45 / models.json
Created October 11, 2026 13:33
MiniMax-M3.1-Flash-Preview on Pi
{
"providers": {
"minimax": {
"models": [
{
"id": "MiniMax-M3.1-Flash-Preview",
"name": "MiniMax-M3.1-Flash-Preview",
"api": "anthropic-messages",
"baseUrl": "https://api.minimax.io/anthropic",
"reasoning": true,
@lucidfrontier45
lucidfrontier45 / get-pi.ts
Created October 5, 2026 00:51
This script downloads a pi release from GitHub and extracts it into a directory you choose. It detects your operating system and CPU architecture, selects the matching release archive, and can install the latest version or a specific version.
/**
* Download and extract a pi GitHub release into a directory.
* Usage: npx tsx install-pi.ts <destination-directory> [version]
* Requires Node.js 20+ and `tar` (available on current Windows, macOS and Linux).
*/
import { spawnSync } from "node:child_process";
import { createWriteStream } from "node:fs";
import { mkdir, readdir, rename, rm, stat } from "node:fs/promises";
import { tmpdir } from "node:os";
import { basename, dirname, join, resolve } from "node:path";
@lucidfrontier45
lucidfrontier45 / mian.py
Last active August 19, 2026 11:23
Test Cache hit/miss after chaning reasoning level
import os
import uuid
from openai import OpenAI
# Prompt caching only applies to sufficiently long prefixes. Keep this prefix
# identical within each trial, while using a unique marker between trials.
def cache_prefix(trial_name: str) -> str:
marker = uuid.uuid4().hex
@lucidfrontier45
lucidfrontier45 / pi-ai-agent-core-sdk.md
Created July 12, 2026 14:00
pi-ai-agent-core-sdk.md

pi-ai + pi-agent-core SDK Reference

Goal

Standalone architecture and reference document for @earendil-works/pi-ai and @earendil-works/pi-agent-core, targeting a developer building an AI agent app with the Pi SDK.

Background

{
"packages": [
"npm:context-mode",
"npm:pi-caveman",
"npm:@taterdoge/pi-ayu",
"npm:pi-opencode-theme",
"npm:@ff-labs/pi-fff",
"npm:pi-hashline-edit",
"npm:pi-rewind",
"npm:@pi-lab/input-history"
@lucidfrontier45
lucidfrontier45 / file-snapshot.ts
Last active May 25, 2026 14:13
oh-my-pi extension to restore files on branch/tree command
/**
* File Snapshot Extension
*
* Snapshots the working directory at each turn start and offers to restore
* files when navigating the session tree or branching.
*
* Uses git ls-files to determine which files to snapshot (respects .gitignore).
* Snapshots are stored in temp directory and cleaned up on session end.
*/
import * as fs from "node:fs/promises";
@lucidfrontier45
lucidfrontier45 / install_superpowers_for_opencode.nu
Created February 13, 2026 04:21
Install Superpowers to project local for OpenCode
# 1. Remove old directories
rm -rf _superpowers
rm -f .opencode/plugins/superpowers.js
rm -rf .opencode/skills/superpowers
# 2. clone the latest version of superpowers
git clone https://github.com/obra/superpowers.git _superpowers --depth 1
# 3. Create directories
mkdir .opencode/plugins .opencode/skills
@lucidfrontier45
lucidfrontier45 / opencode.jsonc
Last active February 12, 2026 14:22
OpenCode Z.AI Coding Plan with Anthropic API
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"z.ai-conding-plan-anthropic": {
// Z.ai provides Anthropic-compatible API endpoints using the Anthropic SDK
"npm": "@ai-sdk/anthropic",
"options": {
// Base URL must use /v1 endpoint for compatibility
"baseURL": "https://api.z.ai/api/anthropic/v1"
},