Skip to content
100% Offline No API Keys

AI Assistant (Offline)

AfterLink ships a 100% offline proprietary AI assistant — a local RAG (Retrieval-Augmented Generation) pipeline that answers technical questions about AfterLink directly in your terminal. No internet. No API keys. No cloud.

What is it?

The @afterlink/ai-assistant package bundles a fully offline Retrieval-Augmented Generation (RAG) pipeline. It uses FAISS vector search, BM25 keyword matching, and a local cross-encoder reranker to answer your questions about AfterLink with verified 100% accuracy — entirely on your machine with no network calls.

Installation

Install globally to use the afterlink-ai command anywhere on your system:

Or install locally inside your project and run it directly:

Example Session

Here is what a real interactive session looks like — showing the assistant's sourced, structured output:

afterlink-ai — terminal
You › how to set up a TLS server
Assistant › [Source: Server SDK: tls.js | Confidence: 99.4% | Latency: 493ms]

🔹 Description / Overview

To enable TLS on your AfterLink server, use generateDevCerts() for local development or pass your own key/cert pair for production.

⚡ Code Boilerplate & Example

const { Server, generateDevCerts } = require('@afterlink/server');
const { key, cert } = await generateDevCerts({ commonName: 'srv' });
const server = new Server({
port: 4443,
tls: { enabled: true, key, cert, rejectUnauthorized: false },
});
await server.listen();

🔗 Official Resources & Sources

Terminal Commands

Command Description
afterlink-ai Start the interactive AI assistant
/reset Clear conversation memory
/history Show past queries this session
/stats Show helpfulness feedback stats
/quit Exit the assistant

How It Works

Every query goes through a multi-stage offline pipeline — no external service calls at any stage:

Component Technology
Vector store FAISS (local, in-process)
Embeddings all-MiniLM-L6-v2 via @xenova/transformers
Keyword search BM25 (Okapi BM25, fully offline)
Reranker ms-marco-MiniLM-L-6-v2 cross-encoder
Query preprocessing Levenshtein spell-correction + acronym/synonym expansion
Session memory Sliding-window context (last 10 turns)

Benchmark Results

100%

overall accuracy
(54/54 queries)

434ms

avg query latency
target < 500ms

~250MB

RAM usage
target < 1GB

None

internet required
fully offline ✓

Metric Result Target
Overall accuracy 100% (54/54 queries) ≥ 80%
Avg query latency 434 ms < 500 ms
RAM usage ~250 MB < 1 GB
Internet required None — fully offline Offline

Accuracy categories: Exact Match · Synonyms · Typos · Follow-up · Out-of-scope · Abbreviations — all at 100%.

Requirements

  • Node.js version ≥ 20
  • ~500 MB disk space (for local model weights, downloaded on first run)
  • ~250 MB RAM during operation