Skip to main content
06 // ENGINEERING SPECIFICATIONShipped — Taskforge Hackathon

PickUp: Offline-First Cognitive Context Recovery PWA

A zero-runtime-dependency, offline-first assistive workflow application designed for neurodivergent developers and students with ADHD to park working memory in under 10 seconds before an interruption and resume flow without task paralysis.

Published 2026-10-2310 min readGitHub Repository
TypeScript 5.5ViteVanilla CSS TokensService WorkerVitestWCAG AA/AAAGemini API

1. Overview#

PickUp ("A Bookmark for Your Brain") is an offline-first, assistive task-resumption Progressive Web Application (PWA) built for neurodivergent knowledge workers and students with ADHD during the Taskforge Hackathon.

Instead of functioning as a full backlog manager, PickUp focuses exclusively on the 10-second transition window when an unexpected interruption occurs and the 2-minute re-entry window when the user returns to their desk:

  1. Park It (10s): Dump unstructured thoughts via keyboard or voice before switching context.
  2. Review Cues: Deterministically extract three recovery cues: Where I was, Next 5-minute action, and Waiting on.
  3. Resume (2 min): Start a calm 2-minute countdown timer framed with low-pressure permission copy ("Just start for 2 minutes. You can stop after.").
  4. Hand Off: Share the active context card via formatted plain text, the native Web Share API, or a serverless #handoff=[base64] URL fragment requiring zero user accounts.

2. The Problem#

  • The Resumption Penalty: Human-computer interaction research demonstrates that recovering deep focus after an interruption averages 23 minutes and 15 seconds. When working memory is dropped abruptly, returning to an IDE or document requires reconstructing what was just finished, what was blocked, and what the very next physical keystroke should be.
  • Why Existing Tools Fail: Conventional task managers (Jira, Notion, Todoist) are designed for project planning rather than rapid cognitive parking. They require choosing projects, tags, and due dates, and greet returning users with overdue red badges and streak warnings that amplify executive dysfunction.
  • Strict Constraints: The application had to load in under 50ms, operate 100% offline with zero cloud accounts or telemetry, meet WCAG AA/AAA accessibility standards, and never block core functionality behind an LLM network call.

3. The Approach#

To achieve instant startup and permanent offline reliability, I made several deliberate architectural decisions (documented in the repository's 10 Architecture Decision Records in docs/DECISIONS.md):

  • Zero Runtime Dependencies (`dependencies: 0`): PickUp is written in strict Vanilla TypeScript (5.5), bundled with Vite, and styled with CSS custom-property design tokens (src/styles/tokens.css). Avoiding a heavy UI framework kept the production bundle tiny and eliminated hydration latency.
  • Deterministic Rule Extraction First, AI Polish Second: The primary cue extractor (src/lib/cardBuilder.ts) uses deterministic clause splitting and regular expression heuristics that execute synchronously on-device. An optional serverless endpoint (api/polish.ts backed by Gemini with an 8-second timeout and rate limiter) is available only when the user explicitly requests AI phrasing polish.
  • Serverless URL-Hash Handoff: To let a user pass a context card from their laptop to their phone or a teammate without a backend database, cards are serialized into a URL hash (#handoff=...), keeping the payload entirely client-side so it is never sent in HTTP request logs.
Specification table (Architectural Dimension, Decision in PickUp, Why It Matters)
Architectural DimensionDecision in PickUpWhy It Matters
Runtime Dependencies0 external runtime packagesInstant cold-start (<50ms) and zero supply-chain bloat
Primary Cue ExtractionSynchronous rule-based heuristics (cardBuilder.ts)Works 100% offline in airplane mode and never hallucinates
PersistenceVersioned localStorage with in-memory fallback (storage/)Survives Safari Private Browsing or storage quota errors without crashing
Screen Reader DisciplineDebounced #live-region (aria-live="polite")Announces state transitions without flooding screen readers every second
Empirical EvaluationBuilt-in ?study=1 research mode with RFC 4180 CSV exportEnables reproducible before/after resumption latency trials

4. System Architecture#

PickUp separates domain models (src/model/), resilient storage adapters (src/storage/), pure extraction/sharing libraries (src/lib/), and accessible view controllers (src/ui/), backed by an offline service worker (public/sw.js) and an optional serverless polish route (api/polish.ts).

SYSTEM SCHEMATIC // PICKUP LOCAL-FIRST PWA & DETERMINISTIC CONTEXT RECOVERY ARCHITECTURE
01. Accessible View Layer (src/ui/)
Park & Review Views

10-second voice/keyboard brain dump and editable 3-cue card preview

parkView.ts · reviewView.ts
Resume & Handoff Views

Calm 2-minute countdown timer and plain-text / Web Share / #handoff link export

resumeView.ts · handoffView.ts
Empirical Study Harness (?study=1)

Researcher stopwatch, condition toggle, 1–5 disorientation rating, and CSV export

studyView.ts · stopwatch.ts
DOM Events & Polite ARIA Announcements
02. Core Domain & Extraction Libraries (src/lib/)
Rule-Based Cue Extractor

Deterministic regex & clause parser extracting whereIWas, nextAction, and waitingOn

src/lib/cardBuilder.ts
Untrusted Hash Codec

Base64 URL encoder/decoder enforcing a strict 2,048-byte ceiling and field truncation

src/lib/handoff.ts
Polite Live-Region Announcer

Clears and populates #live-region with a 50ms tick so screen readers announce cleanly

src/lib/announce.ts
Synchronous Typed Calls
03. Persistence, Offline PWA & Optional Serverless Polish
Resilient Versioned Storage

On-device localStorage with automatic in-memory fallback when quota/privacy blocks writes

src/storage/
Offline Service Worker

Stale-while-revalidate asset caching for 100% offline operation

public/sw.js
Optional AI Polish Endpoint

Serverless Gemini polish with 8s timeout, rate limiter, and automatic fallback to rules

api/polish.ts
Figure: PickUp Local-First PWA & Deterministic Context Recovery Architecture

5. Engineering Deep Dive#

5.1 Deterministic Cue Extraction (`src/lib/cardBuilder.ts`)#

When a user types a hurried note like "Was debugging the OAuth callback race condition; waiting on staging credentials from DevOps; next step check token expiry logs", extractCardCues() splits the input into clauses and applies targeted regular expressions for blockers (waiting on/for, blocked by), next actions (next step, stuck on, todo), and active context (was working on, debugging, finished).

If the user writes "stuck on ..." without a concrete verb, the extractor automatically reframes the phrase into an approachable 5-minute action ("Investigate for 5 minutes: ..."), reducing the activation energy required to restart:

src/lib/cardBuilder.tstypescript
export function extractCardCues(rawText: string): ExtractedCues {
  if (!rawText || typeof rawText !== "string" || !rawText.trim()) {
    return {
      whereIWas: DEFAULT_WHERE_I_WAS,
      nextAction: DEFAULT_NEXT_ACTION,
      waitingOn: "",
      source: "rules",
    };
  }

  const normalized = rawText.trim();
  const clauses = splitClauses(normalized);

  let whereIWas = "";
  let nextAction = "";
  let waitingOn = "";

  // 1. Look for "waiting for" / "waiting on" / "blocked by" cues
  const waitingRegex =
    /(?:waiting\s+(?:on|for)|blocked\s+by|pending|need\s+(?:reply|approval|response)\s+from)\s+([^.?!;\n]+)/i;
  const waitingMatch = normalized.match(waitingRegex);
  if (waitingMatch && waitingMatch[1]) {
    waitingOn = cleanSegment(waitingMatch[1]);
  }

  // 2. Look for "next" / "need to" / "stuck on" / "todo" cues for nextAction
  const nextCuesRegex =
    /(?:next(?:\s+(?:step\s+is|step:|step|up|is))?|next:|stuck\s+on|need\s+to|need|have\s+to|todo:?|plan\s+to)\s+([^.?!;\n]+)/i;
  const nextMatch = normalized.match(nextCuesRegex);

  if (nextMatch && nextMatch[0]) {
    const matchedPrefix = nextMatch[0].toLowerCase();
    const extractedContent = cleanSegment(nextMatch[1]);

    if (matchedPrefix.includes("stuck on")) {
      nextAction = `Investigate for 5 minutes: ${extractedContent}`;
    } else if (extractedContent) {
      nextAction = capitalize(extractedContent);
    }
  }

  // Ensure nextAction reads as a concrete 5-minute action
  if (
    nextAction &&
    !nextAction.toLowerCase().includes("5 minute") &&
    !nextAction.toLowerCase().includes("5-minute")
  ) {
    if (
      nextAction.length < 60 &&
      !nextAction.toLowerCase().startsWith("take") &&
      !nextAction.toLowerCase().startsWith("spend")
    ) {
      nextAction = `Spend 5 minutes to ${
        nextAction.charAt(0).toLowerCase() + nextAction.slice(1)
      }`;
    }
  }

  return {
    whereIWas: truncateText(whereIWas || capitalize(cleanSegment(clauses[0])) || DEFAULT_WHERE_I_WAS, 200),
    nextAction: truncateText(nextAction || DEFAULT_NEXT_ACTION, 200),
    waitingOn: truncateText(waitingOn, 150),
    source: "rules",
  };
}

5.2 Defending Against Untrusted URL-Hash Payloads (`src/lib/handoff.ts`)#

Because #handoff=<base64> links can be constructed by anyone and sent to a user, the decoded data must be treated as untrusted external input. decodeCardFromHash() enforces a strict MAX_HASH_PAYLOAD_BYTES = 2048 ceiling before and after Base64 decoding (preventing memory exhaustion from crafted URLs), validates that the parsed JSON is a non-array object, truncates individual string fields, and pairs with view logic that renders values strictly via element.textContent (never innerHTML), eliminating DOM-based XSS:

src/lib/handoff.tstypescript
export const MAX_HASH_PAYLOAD_BYTES = 2048;

export function decodeCardFromHash(rawHash: string): HandoffPayload | null {
  if (!rawHash || typeof rawHash !== "string") {
    return null;
  }

  let hashValue = rawHash.startsWith("#") ? rawHash.slice(1) : rawHash;
  if (hashValue.startsWith("handoff=")) {
    hashValue = hashValue.slice("handoff=".length);
  }

  // 1. Enforce strict size limit (2048 bytes) before decoding
  if (hashValue.length > MAX_HASH_PAYLOAD_BYTES) {
    console.warn("[PickUp:Handoff] Hash payload exceeds 2048 byte limit.");
    return null;
  }

  try {
    const decodedUrlParam = decodeURIComponent(hashValue);
    const jsonStr =
      typeof atob !== "undefined"
        ? decodeURIComponent(escape(atob(decodedUrlParam)))
        : Buffer.from(decodedUrlParam, "base64").toString("utf-8");

    if (jsonStr.length > MAX_HASH_PAYLOAD_BYTES) {
      return null;
    }

    const parsed = JSON.parse(jsonStr);
    if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
      return null;
    }

    const whereIWas =
      typeof parsed.whereIWas === "string" ? parsed.whereIWas.slice(0, 500).trim() : "";
    const nextAction =
      typeof parsed.nextAction === "string" ? parsed.nextAction.slice(0, 500).trim() : "";
    const waitingOn =
      typeof parsed.waitingOn === "string" ? parsed.waitingOn.slice(0, 300).trim() : undefined;

    if (!whereIWas && !nextAction) return null;

    return {
      whereIWas: whereIWas || "Shared task",
      nextAction: nextAction || "Spend 5 minutes reviewing where they left off",
      waitingOn: waitingOn || undefined,
    };
  } catch {
    return null;
  }
}

5.3 Screen-Reader-Disciplined Live Announcements (`src/lib/announce.ts`)#

A common accessibility bug in timer applications is binding an aria-live region directly to the countdown display, causing VoiceOver or NVDA to read every single second aloud ("1 minute 59 seconds... 1 minute 58 seconds..."). PickUp decouples visual timer ticks from a dedicated #live-region (aria-live="polite") and only announces meaningful state transitions (timer started, halfway mark, timer completed, card copied), clearing the region for 50ms before inserting text so repeated identical actions still trigger announcements:

src/lib/announce.tstypescript
export function announce(message: string): void {
  const region = document.getElementById("live-region");
  if (!region) return;

  // Clear previous message then update to trigger polite re-announcement
  region.textContent = "";
  window.setTimeout(() => {
    region.textContent = message;
  }, 50);
}

6. Technical Demo#

Technical Walkthrough & Verification
Recorded video walkthrough coming soon

Technical walkthrough recording coming soon

Walkthrough of PickUp's 10-second context parking loop, deterministic rule-based cue extractor, 2,048-byte guarded #handoff URL sharing, and on-device ?study=1 empirical research mode.

Walkthrough Sequence & Checkpoints

  1. 00:00
    The 23-Minute Interruption Penalty — Why traditional task managers fail neurodivergent working memory during sudden context switches.
  2. 00:55
    Deterministic Rule Extraction vs. Optional AI Polish — How src/lib/cardBuilder.ts extracts Where I Was, Next 5-Minute Action, and Waiting On in <1ms offline.
  3. 02:10
    Untrusted URL-Hash Handoff Security — Inspecting src/lib/handoff.ts: 2,048-byte limit, Base64 JSON schema validation, and textContent-only DOM rendering.
  4. 03:20
    Empirical Study Mode (?study=1) & 72 Vitest Tests — Running the built-in usability study stopwatch and RFC 4180 CSV exporter.
View Written Walkthrough Summary / Transcript ▾

Empirical research shows that recovering deep focus after an interruption takes an average of 23 minutes and 15 seconds. For developers and students with ADHD, working memory is volatile: a single Slack ping or knock at the door can wipe out mental state and trigger hours of task paralysis.

PickUp was built for the Taskforge Hackathon with zero external runtime dependencies. When an interruption hits, you dump a messy sentence via keyboard or Web Speech API in under 10 seconds. Our deterministic rule extractor in src/lib/cardBuilder.ts immediately parses the note into three structured recovery cues—Where I Was, Next 5-Minute Action, and Waiting On—working 100% offline.

When you return, PickUp presents a calm single-action screen with a 2-minute permission timer ('Just start for 2 minutes. You can stop after.') and polite ARIA live announcements that never spam screen readers on every countdown tick.

7. Challenges and Trade-offs#

  • Cross-Browser Unicode Base64 Encoding: Native browser btoa() throws a DOMException (InvalidCharacterError) when given UTF-8 strings containing emojis or non-Latin scripts, while Node.js (used in Vitest tests) may run in environments without window.btoa. Implementing dual-environment UTF-8-safe encoding (encodeURIComponent + unescape with Buffer fallback) allowed #handoff URLs to safely transport non-English notes and pass Node-based unit tests.
  • Storage Resilience Under Strict Privacy Settings: When users run a browser with localStorage disabled or full, uncaught QuotaExceededError or SecurityError exceptions crash standard SPAs. Wrapping all persistence adapters (draftStorage.ts, settingsStorage.ts, studyStorage.ts) with an automatic in-memory fallback map ensured the app remains usable even when storage is blocked.
  • Trading Rich Formatting for Plain-Text Portability: Rather than building a proprietary cloud card viewer, Handoff prioritizes plain-text templates (📌 PickUp Card) and #handoff URL fragments so cards paste cleanly into Slack, Discord, GitHub issues, or SMS.

8. Testing and Validation#

  • 72 Automated Unit Tests (Vitest): The repository includes 72 passing Vitest unit tests across 12 test suites (npm test), covering cardBuilder clause extraction (empty inputs, run-on sentences, non-Latin scripts), handoff URL encoding/decoding (oversized >2,048-byte payloads, malformed Base64, array/primitive JSON injection), countdown timer and stopwatch state machines, and resilient storage fallbacks.
  • Strict TypeScript Verification: Verified across src/, api/, and test/ via npm run typecheck (tsc --noEmit in TypeScript 5.5 strict mode).
  • Accessibility & Empirical Study Protocol: Documented manual keyboard navigation, VoiceOver/NVDA/TalkBack checklists (docs/A11Y_CHECKLIST.md), and built an on-device research mode (?study=1) that records participant condition (With PickUp vs. Without PickUp), resumption latency in milliseconds, and 1–5 cognitive disorientation scores, exporting directly to RFC 4180 CSV (pickup_study_results.csv).

9. What I Learned#

  • Deterministic heuristics beat LLMs on latency-critical paths: When a user has 10 seconds before a meeting or interruption, waiting 2–4 seconds for a cloud LLM call adds friction and fails offline. A well-crafted rule extractor runs in under a millisecond and handles 90%+ of quick context notes.
  • Zero-dependency Vanilla TypeScript scales cleanly with strict module boundaries: Separating model/, storage/, lib/, and ui/ gave the codebase the maintainability of a framework app without shipping a single kilobyte of framework runtime.

10. Future Improvements#

  • Keyboard Shortcut Global Launcher: Package PickUp as a lightweight desktop/browser extension command palette so developers can trigger the 10-second Park view via a global hotkey without switching browser tabs.
  • Encrypted Handoff Fragments: Add optional Web Crypto API (AES-GCM) password protection for #handoff links containing sensitive internal task names.