← All writing

AI applications

Writing

// Simplified: response parsing and error handling omitted.
async function callTool(endpoint, token, name, args) {
  let session = null;
  let id = 0;
  const post = async (body) => {
    const headers = {

One memory for several AI tools

Claude Code, Codex and Hermes each kept their own notes. Two small hooks and one shared memory service changed that. What we built, why the hooks talk HTTP instead of using MCP tools, and what broke on the first day.

AI applicationsArchitectureReliability
export async function compare(variants, cases, check) {
  const results = {};
  for (const [name, run] of Object.entries(variants)) {
    const rows = [];
    for (const c of cases) {
      let output;

A small test harness for prompts: same cases, every change

About forty lines of code that run the same cases against several variants and count passes, failures and missing results separately. Tried on our semantic search and on a small local model, where it caught a problem nobody was looking for.

AI applicationsTestingEvaluation
const cosine = (a, b) => a.reduce((sum, x, i) => sum + x * b[i], 0);

const hits = index
  .map((chunk) => ({...chunk, score: cosine(queryVector, chunk.vector)}))
  .sort((a, b) => b.score - a.score)
  .slice(0, 3);

Semantic search over our own articles, with a local model

A small, runnable build: index this site’s English and Turkish articles with a multilingual embedding model on your own machine, search by meaning, and look honestly at where it works and where it does not.

AI applicationsArchitectureEvaluation
const prompt = `You review pull requests for a payments service.
Summarise the risks in the diff for the on-call engineer.

Rules:
- At most five bullet points, most severe first.
- If nothing is risky, answer "No risk found".

How to write a prompt: clear task, examples and separated data

The second note in the series: what a good prompt contains, why examples work so well, how to keep instructions apart from data, and why prompts deserve tests.

AI applications
function summarize(successes, assessed, unresolved) {
  const total = assessed + unresolved;
  return {
    observed: assessed ? successes / assessed : null,
    lower: total ? successes / total : null,
    upper: total ? (successes + unresolved) / total : null,

Eight correct answers: is that really 100%?

What happens to a score when unanswered cases are left out, and how to report it honestly.

EvaluationTestingAI applications
export function decide(x) {
  if (x.privateSource) return 'private';
  if (x.sensitive) return 'review';
  if (!x.evidence) return 'reject';
  return x.confidence >= 0.9 ? 'publish' : 'review';
}

AI sounds certain. Should we publish it?

A small experiment that separates three questions a confidence score cannot answer on its own: is it supported, is it sensitive, and may it be shared?

AI applicationsReliabilityTesting