Skip to content

Instantly share code, notes, and snippets.

View machuwey's full-sized avatar
the clock is ticking

machuwey machuwey

the clock is ticking
  • Spain
View GitHub Profile

MindRAG: A Prompt Template That Reads Between the Lines

Most RAG systems retrieve what matches the words. This one retrieves what produces understanding.

The idea is simple: before retrieving anything, the system figures out what you actually need. Then it retrieves what the answer will fail without — not just what matches your keywords. Then it writes an answer that pre-answers your follow-up questions so you don't have to ask them.

Three steps of "mind-reading" before a single word of answer is written:

  1. Intent Reader — figures out what you actually need vs. what you literally typed
  2. Smart Retriever — finds what the answer will break without, ignores what looks relevant but isn't
@machuwey
machuwey / ecomm-decapcms-config.yml
Created January 10, 2025 12:59
DecapCMS config.yml template schema for ecommerce sites
local_backend: true
backend:
name: github
repo: <user>/repo
branch: main
media_folder: "public/images/uploads"
@machuwey
machuwey / moa.swift
Created January 7, 2025 23:46
Deploy a MOA starknet account in swift
func deployMoaAccountSimple(participants: [Participant], threshold: Int) async throws -> (StarknetInvokeTransactionResponse, Felt) {
guard let account_contract_class_hash = Felt(fromHex: "0x04ec7e8c3ece2ae9652611e1c329ad3d492aa52f23b681d50bdc65085f97dd59") else {
throw TransactionError.errorParsinFelt
}
guard let privateKeyData = KeychainHelper.standard.retrievePrivateKey(service: "com.strapex.wallet", account: keychainAccountString!),
let private_key_felt = Felt(privateKeyData) else {
throw TransactionError.privateKeyNotFound
}
guard let address_felt = accountStore.address, let provider = accountStore.provider else {
@machuwey
machuwey / template-ecom-schema.schema
Created January 3, 2025 14:57
A comprehensive PostgreSQL schema for e-commerce platforms supporting physical and digital products, multi-currency pricing, and international sales.
// Database configuration
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
// Prisma client generator
generator client {
provider = "prisma-client-js"
@machuwey
machuwey / swapIndexer.ts
Created October 21, 2024 12:52
# Solana Token Swap Tracker This script tracks and analyzes token swap transactions on the Solana blockchain.
import express from 'express';
import path from 'path';
import { BlockResponse, Connection } from '@solana/web3.js';
import { findFirstTransactionBlock } from './getFirstTransactionBlock';
import { createObjectCsvWriter } from 'csv-writer';
import fs from 'fs';
import Bottleneck from 'bottleneck';
import cliProgress from 'cli-progress';
// Environment Variables
@machuwey
machuwey / collect_code.sh
Created September 22, 2024 21:40 — forked from sullyo/collect_code.sh
Clones a github repo and puts all the code into a single text file perfect for LLMs
#!/bin/bash
# Check if a GitHub URL is provided as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <github_url>"
exit 1
fi
# Store the GitHub URL
GIT_URL="$1"
# Appendix
The following sections contain reference material you may find useful in your
Cairo journey.
# Appendix A - Keywords
The following list contains keywords that are reserved for current or future use by the Cairo language.
There are three keyword categories: