Arachne
Case Study
Overview
An internal assistant that answers staff questions from company documents, cites the exact page behind every claim, and draws what you've learned as a web.
Runs on a seeded set of 9 sample company documents (41 passages). Below a 0.55 similarity score it says it couldn't find an answer instead of guessing.
Where it started
Arachne began as a university assignment I did for Telstra in my final year: an internal assistant that helps staff find answers in company documents.
I've since rebuilt it from scratch and put my own spin on it. The web running through everything (the name, the orb web you grow by asking questions, Spider-Sense, and ranks from Spiderling to Arachne Sentinel) is a not-so-subtle hint at my love for Spider-Man.
The problem
Staff lose time digging through handbooks and policies, and an assistant that guesses is worse than no answer at all. Arachne only answers from the documents each person is allowed to see, cites the page or section behind every claim, and says plainly when the documents don't cover something.
How it answers
Questions are embedded locally, matched against document passages in Postgres with pgvector, filtered to the asker's team, and sent to Claude as numbered sources. The answer streams back word by word, followed by its citations, so every [1] opens the exact passage it came from.
arachne/api.py
async def search(text: str, team: str, k: int) -> List[Hit]:
vec = await embed(text)
rows = await db.pool.fetch(
"""SELECT c.id, d.title, c.locator, c.content, 1 - (c.embedding <=> $1) AS score
FROM chunks c JOIN documents d ON d.id = c.document_id
WHERE d.team IN ('all', $2)
ORDER BY c.embedding <=> $1
LIMIT $3""",
vec, team, k,
)
hits = [Hit(**dict(r)) for r in rows if r["score"] >= MIN_SCORE]
return hits + await follow_references(hits, team)
Spider-Sense
After each answer, Arachne averages the embeddings of the passages it cited and suggests the neighbouring sections you'll probably need next. One click asks about them. Questions it couldn't answer collect in Holes in Your Web, a ready-made list of documentation gaps.
arachne/insights.py
async def spider_sense(answer: str, hits: List[Hit], team: str, limit: int = 3) -> List[dict]:
"""Passages that sit next to what the answer cited, but weren't part of it."""
cited = [hits[n - 1].id for n in cited_numbers(answer) if 1 <= n <= len(hits)]
if not cited:
return []
rows = await db.pool.fetch(
"""WITH centre AS (SELECT avg(embedding) AS v FROM chunks WHERE id = ANY($1::int[]))
SELECT d.title, c.locator, c.content, 1 - (c.embedding <=> centre.v) AS score
FROM chunks c JOIN documents d ON d.id = c.document_id, centre
WHERE d.team IN ('all', $2) AND c.id <> ALL($3::int[])
ORDER BY c.embedding <=> centre.v
LIMIT 12""",
cited, team, [h.id for h in hits],
)
Your Web
Each person's knowledge is drawn as an orb web in Three.js. Every document anchors a spoke, the capture spiral gains rings as you ask more, each chat hangs on it as a dewdrop, and the sections Arachne has cited for you light up.
arachne/static/js/constellation.js
// ---- spokes: one per document, with frame spokes between them ----
const nd = Math.max(docs.length, 1);
const docAngle = (i) => -Math.PI / 2 + (i / nd) * Math.PI * 2;
const rings = Math.max(3, Math.min(22, 3 + Math.round(questions * 0.7)));
// ---- chats: dewdrops along the spiral, tied to the sections they cited ----
chats.forEach((chat, k) => {
const f = (k + 1) / (chats.length + 1);
const a = -Math.PI / 2 + f * turns * Math.PI * 2;
const r = R * (0.16 + 0.76 * f);
const pos = new THREE.Vector3(Math.cos(a) * r, Math.sin(a) * r, 0.35 + rand() * 0.4);
dew.add(pos.toArray(), { size: 10, kind: KIND.text, alpha: 0.95, t: 0.3 + 0.6 * f, phase: rand() });
});