Skip to content

Instantly share code, notes, and snippets.

View dhaupin's full-sized avatar

dhaupin dhaupin

View GitHub Profile
@dhaupin
dhaupin / gist:6b9d33ae054b6aa60a033fae36fd06e4
Last active July 28, 2026 19:40
Vant cache hit analysis
To effectively utilize prompt caching and prevent massive token inflation on MiniMax, you need to intentionally design your prompt architecture.
The underlying mechanisms are identical for both MiniMax 2.5 and MiniMax 2.7. Both models leverage an [Anthropic-compatible API endpoint](https://platform.minimax.io/docs/api-reference/anthropic-api-compatible-cache) (/v1/messages), meaning they rely on explicit prefix matching using strict byte-by-byte rules. [1, 2, 3, 4]
The structural rules to prevent breaking the cache across requests include the following:
## 1. Enforce a Strict Top-Down Structure
MiniMax constructs its cache strictly from left to right in a fixed sequence: Tool Definitions → System Prompts → Early User Messages → Dynamic Context. [5]
*
* The Rule: Any change to a single character at the top of the prompt invalidates everything below it.
* The Fix: Push all fluid variables—such as timestamps, rotating user names, conversation histories, and tool output logs—to the absolute bottom of the payl
@dhaupin
dhaupin / Tmp.lol
Last active July 26, 2026 06:34
Tmp
That makes complete sensewhen a project grows into a distributed agentic runtime with file/git-backed state (like Vant's multi-brain refactors), lib/do.js isn't just a utility helper. Its a Command Dispatcher / Pipeline Execution Engine.
Youre trying to build a Unified Task Strategy Enforcer (or Execution Middleware). It's essentially the Command Pattern + Strategy Pattern built specifically for Node runtime operations.
Here is an architectural mental model and pattern that turns do.js into an extensible, state-aware execution engine.
The Pattern: Execution Handler Engine (lib/do.js)
Instead of just checking { sync: true }, do.js acts as a pipeline gatekeeper that normalizes incoming tasks, applies interceptors (like state tracking, logging, or escrow/sandboxing), and executes via strategy handlers.
// lib/do.js
class TaskDispatcher {
constructor(globalConfig = {}) {
this.config = globalConfig;
@dhaupin
dhaupin / Vant-0.8.6-flow.txt
Created May 30, 2026 02:29
Vant-0.8.6-flow
╔══════════════════════════════════════════════════════════════════════╗
║ vant.js (MAIN) ║
╠══════════════════════════════════════════════════════════════════════╣
║ ║
║ init() ──────→ boot.init() ║
║ └─ 1. sudo.createTask() ║
║ └─ 2. sandbox.init() ║
║ └─ 3. qos.init() ║
║ └─ 4. escrow init ║
║ └─ 5. lock.init() ║
@dhaupin
dhaupin / prompt-think-all.md
Last active May 9, 2026 05:11
Promp Thinking

Let's discuss, and prepare batches. Don't build yet. Deep think in code review mode please. Consider the outcomes on a specific level, and on a global app level. Consider documentation, setup, and edge cases. Take your time. Thank you.

@dhaupin
dhaupin / prompt-batch-all.md
Last active May 7, 2026 00:59
Prompt Batching - Clean

Batch through each task, documenting changes, additions, and/or features and adding to changelog. Do QC, Qos, and security passes/audits after each batch. Use deep think, code review skill, triaging with experts and utilizing skills. Take your time. Think it through. Do not bump version anywhere unless requested by user. Thank you!

@dhaupin
dhaupin / prompt-batch-vant.md
Last active May 7, 2026 00:58
Prompt Batching - Vant

Batch through each task, documenting changes, additions, and/or features on /docs, cli/mcp help, /dist, and/or changelog. Do QC, Qos, and security passes/audits after each batch. Use deep think, code review skill, triaging with experts and utilizing skills. Take your time. Think it through. Do not bump version anywhere unless requested by user. Thank you!

@dhaupin
dhaupin / tmp-console-dump.md
Last active May 7, 2026 01:01
TMP Console Dump
We couldn’t find that file to show.
@dhaupin
dhaupin / gist:28328adbb95d09ce6f05bedb70b7f925
Created April 7, 2026 23:12
Moto Android 15 Touch Sensitivity Settings
Android settings and ADB commands that may or may not increase touch sensitivity on moto devices.
------------------------------------------------
settings put system touch_sensitivity_mode 1
settings put secure screen_protector_mode 1
------------------------------------------------
settings put system glove_use 1
@dhaupin
dhaupin / dev_wp_shortcode_woo_login_register.php
Last active November 15, 2020 06:16
Wordpress shortcode to display WP or Woocommerce login forms
<?php
/**
* Shortcode - Render Wordpress login form
**/
add_shortcode('wp_login_form', function() {
if (is_user_logged_in()) {
} else {
ob_start();
@dhaupin
dhaupin / dev_script_ckeditor_plugin_wrapper.js
Last active June 28, 2017 18:51
CKEditor - Example Plugin Wrapper/Init for Config.js - Extending Autosave
// Make sure you include the plugin_wrapper as last item in config.extraPluins
CKEDITOR.editorConfig = function(config) {
config.extraPlugins = 'autosave,plugin_wrapper';
// Define empty autosave object
config.autosave = {};
}
// Extend instance plugins
CKEDITOR.plugins.add('plugin_wrapper', {