Repository Analysis

unicity-sphere/sphere-sdk

The SDK for autonomous economic agents. Give an agent an identity, a wallet, and the ability to find, negotiate with, and settle with other agents - peer-to-peer, with perfect privacy and ultra-fast finality

5.3 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of unicity-sphere/sphere-sdk, a TypeScript project with 5,422 GitHub stars. SynthScan v2.0 examined 158,548 lines of code across 427 source files, recording 478 pattern matches distributed across 8 syntactic categories. The overall adjusted score of 5.3 places this repository in the Low AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

5.3
Adjusted Score
5.3
Raw Score
100%
Time Factor
2026-07-14
Last Push
5.4K
Stars
TypeScript
Language
158.5K
Lines of Code
427
Files
478
Pattern Hits
2026-07-14
Scan Date
0.02
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 7HIGH 0MEDIUM 92LOW 379

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 478 distinct pattern matches across 8 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Decorative Section Separators91 hits · 284 pts
SeverityFileLineSnippetContext
MEDIUMeslint.config.js22 // ── token-engine boundary ───────────────────────────────────────────────────COMMENT
MEDIUMimpl/nodejs/storage/FileTokenStorageProvider.ts235 // ── Lazy inventory port (sdk-changes S2) — default whole-blob adapter ──────COMMENT
MEDIUMimpl/shared/ipfs/ipfs-storage-provider.ts598 // ── Lazy inventory port (sdk-changes S2) — default whole-blob adapter ──────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiTokenStorageProvider.ts129 // ── provider lifecycle ──────────────────────────────────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiTokenStorageProvider.ts192 // ── persisted sync state (per network + identity) ───────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiTokenStorageProvider.ts234 // ── inventory sync (§5.1) ───────────────────────────────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiTokenStorageProvider.ts307 // ── lazy inventory port (S2) ────────────────────────────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiTokenStorageProvider.ts403 // ── recovery (§5.3, sdk-changes S2) ─────────────────────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiTokenStorageProvider.ts468 // ── whole-blob surface (thin: the hot path is the lazy port above) ──────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiMailboxProvider.ts157 // ── persisted state (per network + identity) ────────────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiMailboxProvider.ts207 // ── deliver (S3: upload → deposit) ──────────────────────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiMailboxProvider.ts295 // ── incoming (S3: mailbox pull) ─────────────────────────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiMailboxProvider.ts404 // ── ack (claim / reject) ────────────────────────────────────────────────────COMMENT
MEDIUMimpl/shared/wallet-api/WalletApiMailboxProvider.ts456 // ── wake (optional hook — §9: a nudge, never a correctness dependency) ──────COMMENT
MEDIUMimpl/browser/storage/IndexedDBTokenStorageProvider.ts284 // ── Lazy inventory port (sdk-changes S2) — default whole-blob adapter ──────COMMENT
MEDIUMwallet-api/codec.ts194// ── mailbox (§6/§16) ──────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/codec.ts270// ── payment requests (§10/§16) ────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/codec.ts336// ── history (§10/§16) ─────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/types.ts13// ── collaborator ports (DI — no singletons) ──────────────────────────────────COMMENT
MEDIUMwallet-api/types.ts82// ── client config / identity ─────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/types.ts154// ── REST result shapes (§16) ──────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/types.ts215// ── mailbox (§6/§16) ──────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/types.ts274// ── history (§10/§16) ─────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/types.ts311// ── payment requests (§10/§16) ────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts305 // ── storage keys (scoped per network + pubkey + device) ────────────────────COMMENT
MEDIUMwallet-api/client.ts331 // ── auth (ARCHITECTURE §4) ──────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts444 // ── request core ────────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts600 // ── inventory / blobs (§16) ─────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts692 // ── mailbox (§6/§16) ────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts745 // ── history (§10/§16) ───────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts765 // ── payment requests (§10/§16) ──────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts830 // ── intents (E.3) ───────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts920 // ── intent progress: the E.4 burn checkpoint (sphere-sdk#501) ────────────────COMMENT
MEDIUMwallet-api/client.ts920 // ── intent progress: the E.4 burn checkpoint (sphere-sdk#501) ────────────────COMMENT
MEDIUMwallet-api/client.ts1086 // ── syncEpoch (§5.4/§9) ─────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/client.ts1107 // ── realtime (§9) ───────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/wake-supervisor.ts112 // ── connect / drop ──────────────────────────────────────────────────────────COMMENT
MEDIUMwallet-api/wake-supervisor.ts188 // ── liveness watchdog ────────────────────────────────────────────────────────COMMENT
MEDIUMoracle/oracle-provider.ts36 // ── v2 token-engine config surface ─────────────────────────────────────────COMMENT
MEDIUMtests/unit/token-engine/FakeTokenEngine.ts229 // ── internals ──────────────────────────────────────────────────────────────COMMENT
MEDIUM…ts/unit/modules/PaymentsModule.journey-backlog.test.ts208 // ── Session 1 ─────────────────────────────────────────────────────────────COMMENT
MEDIUM…ts/unit/modules/PaymentsModule.journey-backlog.test.ts380 // NON-EMPTY and the wallet-api cursor is warm. ──────────────────────────────COMMENT
MEDIUM…ts/unit/modules/PaymentsModule.journey-backlog.test.ts391 // its client is dead at init: every request throws. ───────────────────────COMMENT
MEDIUM…ts/unit/modules/PaymentsModule.journey-backlog.test.ts403 // advanced it; the live load does). ───────────────────────────────────────COMMENT
MEDIUM…ts/unit/modules/PaymentsModule.journey-backlog.test.ts434 // send POSTs one dedupKey'd §10 record (the server is the durable log). ─────COMMENT
MEDIUM…ts/unit/modules/PaymentsModule.journey-backlog.test.ts451 // exhaustion. ─────────────────────────────────────────────────────────────COMMENT
MEDIUM…act/wallet-api-token-storage-provider.contract.test.ts60// ── the shared S7 contract ─────────────────────────────────────────────────────COMMENT
MEDIUM…act/wallet-api-token-storage-provider.contract.test.ts75// ── remote-only S2 semantics ───────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts286 // ── test hooks / counters ────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts315 // ── lifecycle ────────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts340 // ── test hooks ───────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts583 // ── owner state ──────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts606 // ── HTTP plumbing ────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts699 // ── auth (§4) ────────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts839 // ── inventory (§5.1, §16) ────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts907 // ── blobs (§5.2) ─────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts1020 // ── apply-delta (§5.3) ──────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts1217 // ── mailbox (§6, §16) ────────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts1591 // ── history (§10, §16) ───────────────────────────────────────────────────────COMMENT
MEDIUMtests/support/fake-wallet-api.ts1685 // ── payment requests (§10, §16 — backend M4) ─────────────────────────────────COMMENT
31 more matches not shown…
Structural Annotation Overuse140 hits · 212 pts
SeverityFileLineSnippetContext
LOWtests/unit/modules/AccountingModule.events.test.ts898 // Step 1: Pre-populate ledger with an on-chain entry that says "back"COMMENT
LOWtests/unit/modules/AccountingModule.events.test.ts912 // Step 2: Build an incoming transfer where the transport memo says "F" (forward)COMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts346 // Step 1: Add tokenCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts351 // Step 2: Remove token (spent) - creates tombstoneCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts356 // Step 3: Re-add same token (Nostr re-delivery) → rejectedCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts366 // Step 1: Add tokenCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts370 // Step 2: Remove token (spent) - creates tombstoneCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts374 // Step 3: Add token with new state (legitimate new state after transfer back)COMMENT
LOWtests/integration/swap-lifecycle.test.ts689 // Step 1: Party A proposes swap to party BCOMMENT
LOWtests/integration/swap-lifecycle.test.ts699 // Step 2: Party B should have received the proposalCOMMENT
LOWtests/integration/swap-lifecycle.test.ts704 // Step 3: Party B accepts the proposalCOMMENT
LOWtests/integration/swap-lifecycle.test.ts755 // Step 6: Both parties verify payoutCOMMENT
LOWtests/integration/swap-lifecycle.test.ts765 // Step 7: Assert both in 'completed' stateCOMMENT
LOWtests/integration/swap-lifecycle.test.ts783 // Step 1: Party A proposesCOMMENT
LOWtests/integration/swap-lifecycle.test.ts788 // Step 2: Party B receives proposalCOMMENT
LOWtests/integration/swap-lifecycle.test.ts792 // Step 3: Party B rejectsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts796 // Step 4: Party A receives rejection DM -> transitions to 'cancelled'COMMENT
LOWtests/integration/swap-lifecycle.test.ts826 // Step 1: Party A proposesCOMMENT
LOWtests/integration/swap-lifecycle.test.ts832 // Step 2: Party B acceptsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts845 // Step 4: Escrow times out and sends swap_cancelledCOMMENT
LOWtests/integration/swap-lifecycle.test.ts849 // Step 5: Assert both parties in 'cancelled' stateCOMMENT
LOWtests/integration/swap-lifecycle.test.ts890 // Step 2: Party A cancels before depositingCOMMENT
LOWtests/integration/swap-lifecycle.test.ts893 // Step 3: Assert party A's swap is 'cancelled'COMMENT
LOWtests/integration/swap-lifecycle.test.ts981 // Step 3: Party B accepts all threeCOMMENT
LOWtests/integration/swap-lifecycle.test.ts987 // Step 4: All three should progress independentlyCOMMENT
LOWtests/integration/swap-lifecycle.test.ts727 // Step 5: Escrow detects both depositsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts875 // Step 1: Party A proposes, party B acceptsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts957 // Step 1: Party A proposes all three swapsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts969 // Step 2: Party B should have received all three proposalsCOMMENT
LOWtests/integration/wallet-clear-indexeddb.test.ts117 // Step 1: destroy() — shuts down providersCOMMENT
LOWtests/integration/wallet-clear-indexeddb.test.ts122 // Step 2: disconnect providers (as SphereProvider does)COMMENT
LOWtests/integration/wallet-clear-indexeddb.test.ts128 // Step 3: Sphere.clear() internals — yield + clearCOMMENT
LOWdocs/QUICKSTART-NODEJS.md208// Step 1: Create base providersCOMMENT
LOWdocs/QUICKSTART-NODEJS.md247// Step 2: Compose wallet-api providers (required for v2 mailbox delivery)COMMENT
LOWdocs/INTEGRATION.md30### Step 1: Create Base ProvidersCOMMENT
LOWdocs/INTEGRATION.md91### Step 2: Compose v2 Wallet-Api ProvidersCOMMENT
LOWdocs/INTEGRATION.md119### Step 3: Alternative Composition (Bring Your Own Storage)COMMENT
LOWdocs/INTEGRATION.md136### Step 4: Initialize the WalletCOMMENT
LOWdocs/INTEGRATION.md165// Step 1: Base providersCOMMENT
LOWdocs/INTEGRATION.md173// Step 2: Compose with wallet-apiCOMMENT
LOWdocs/INTEGRATION.md180// Step 3: Initialize walletCOMMENT
LOWdocs/INTEGRATION.md186// Step 4: Use v2 payments (sender-driven, certified on-chain, delivered via mailbox)COMMENT
LOWdocs/QUICKSTART-BROWSER.md31 // Step 1: Create base providers (storage + transport + oracle)COMMENT
LOWdocs/QUICKSTART-BROWSER.md37 // Step 2: Wrap with wallet-api for v2 mailbox delivery and token storageCOMMENT
LOWdocs/QUICKSTART-BROWSER.md44 // Step 3: Initialize walletCOMMENT
LOWdocs/QUICKSTART-BROWSER.md74 // Step 1: Create base providersCOMMENT
LOWdocs/QUICKSTART-BROWSER.md80 // Step 2: Wrap with wallet-api for v2 deliveryCOMMENT
LOWdocs/QUICKSTART-BROWSER.md87 // Step 3: Initialize walletCOMMENT
LOWdocs/QUICKSTART-BROWSER.md151 // Step 1: Create base providersCOMMENT
LOWdocs/QUICKSTART-BROWSER.md157 // Step 2: Wrap with wallet-api for v2 deliveryCOMMENT
LOWdocs/QUICKSTART-BROWSER.md164 // Step 3: Initialize walletCOMMENT
LOWdocs/QUICKSTART-BROWSER.md212 // Step 1: Create base providersCOMMENT
LOWdocs/QUICKSTART-BROWSER.md218 // Step 2: Wrap with wallet-api for v2 deliveryCOMMENT
LOWdocs/QUICKSTART-BROWSER.md225 // Step 3: Initialize walletCOMMENT
LOWdocs/QUICKSTART-BROWSER.md266// Step 1: Base providers (required for network, oracle, transport)COMMENT
LOWdocs/QUICKSTART-BROWSER.md307// Step 2: Wrap with wallet-api for v2 mailbox delivery (REQUIRED for v2)COMMENT
LOWdocs/QUICKSTART-BROWSER.md314// Step 3: Initialize wallet with the composed providersCOMMENT
LOWdocs/QUICKSTART-BROWSER.md696 // Step 1: Create base providersCOMMENT
LOWdocs/QUICKSTART-BROWSER.md702 // Step 2: Wrap with wallet-api for v2 deliveryCOMMENT
LOWdocs/QUICKSTART-BROWSER.md709 // Step 3: Initialize walletCOMMENT
80 more matches not shown…
Verbosity Indicators112 hits · 156 pts
SeverityFileLineSnippetContext
LOWtests/unit/modules/AccountingModule.events.test.ts898 // Step 1: Pre-populate ledger with an on-chain entry that says "back"COMMENT
LOWtests/unit/modules/AccountingModule.events.test.ts912 // Step 2: Build an incoming transfer where the transport memo says "F" (forward)COMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts346 // Step 1: Add tokenCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts351 // Step 2: Remove token (spent) - creates tombstoneCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts356 // Step 3: Re-add same token (Nostr re-delivery) → rejectedCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts366 // Step 1: Add tokenCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts370 // Step 2: Remove token (spent) - creates tombstoneCOMMENT
LOWtests/unit/modules/PaymentsModule.tombstone.test.ts374 // Step 3: Add token with new state (legitimate new state after transfer back)COMMENT
LOWtests/integration/swap-lifecycle.test.ts689 // Step 1: Party A proposes swap to party BCOMMENT
LOWtests/integration/swap-lifecycle.test.ts699 // Step 2: Party B should have received the proposalCOMMENT
LOWtests/integration/swap-lifecycle.test.ts704 // Step 3: Party B accepts the proposalCOMMENT
LOWtests/integration/swap-lifecycle.test.ts755 // Step 6: Both parties verify payoutCOMMENT
LOWtests/integration/swap-lifecycle.test.ts765 // Step 7: Assert both in 'completed' stateCOMMENT
LOWtests/integration/swap-lifecycle.test.ts783 // Step 1: Party A proposesCOMMENT
LOWtests/integration/swap-lifecycle.test.ts788 // Step 2: Party B receives proposalCOMMENT
LOWtests/integration/swap-lifecycle.test.ts792 // Step 3: Party B rejectsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts796 // Step 4: Party A receives rejection DM -> transitions to 'cancelled'COMMENT
LOWtests/integration/swap-lifecycle.test.ts826 // Step 1: Party A proposesCOMMENT
LOWtests/integration/swap-lifecycle.test.ts832 // Step 2: Party B acceptsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts845 // Step 4: Escrow times out and sends swap_cancelledCOMMENT
LOWtests/integration/swap-lifecycle.test.ts849 // Step 5: Assert both parties in 'cancelled' stateCOMMENT
LOWtests/integration/swap-lifecycle.test.ts890 // Step 2: Party A cancels before depositingCOMMENT
LOWtests/integration/swap-lifecycle.test.ts893 // Step 3: Assert party A's swap is 'cancelled'COMMENT
LOWtests/integration/swap-lifecycle.test.ts981 // Step 3: Party B accepts all threeCOMMENT
LOWtests/integration/swap-lifecycle.test.ts987 // Step 4: All three should progress independentlyCOMMENT
LOWtests/integration/swap-lifecycle.test.ts727 // Step 5: Escrow detects both depositsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts875 // Step 1: Party A proposes, party B acceptsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts957 // Step 1: Party A proposes all three swapsCOMMENT
LOWtests/integration/swap-lifecycle.test.ts969 // Step 2: Party B should have received all three proposalsCOMMENT
LOWtests/integration/wallet-clear-indexeddb.test.ts117 // Step 1: destroy() — shuts down providersCOMMENT
LOWtests/integration/wallet-clear-indexeddb.test.ts122 // Step 2: disconnect providers (as SphereProvider does)COMMENT
LOWtests/integration/wallet-clear-indexeddb.test.ts128 // Step 3: Sphere.clear() internals — yield + clearCOMMENT
LOWregistry/TokenRegistry.ts215 // Step 1: Try loading from cacheCOMMENT
LOWregistry/TokenRegistry.ts229 // Step 2: Cache miss — wait for first remote fetch (only when auto-refresh is enabled)COMMENT
LOWmodules/accounting/AccountingModule.ts502 // Step 7: Load auto-return dedup ledger — prune and crash recoveryCOMMENT
LOWmodules/accounting/AccountingModule.ts510 // Step 8: Populate invoice-transfer index (§5.4.4)COMMENT
LOWmodules/accounting/AccountingModule.ts567 // Step 9: Subscribe to PaymentsModule events (MUST come after index build)COMMENT
LOWmodules/accounting/AccountingModule.ts574 // Step 10: Subscribe to CommunicationsModule DM events if availableCOMMENT
LOWmodules/accounting/AccountingModule.ts1067 // Step 14: Fire 'invoice:created' eventCOMMENT
LOWmodules/accounting/AccountingModule.ts1076 // Step 15: Return resultCOMMENT
LOWmodules/accounting/AccountingModule.ts1478 // Step 1: Verify invoice existsCOMMENT
LOWmodules/accounting/AccountingModule.ts1488 // Step 2: Check if terminal — reconstruct from frozen balancesCOMMENT
LOWmodules/accounting/AccountingModule.ts2653 // Step 1: Invoice must existCOMMENT
LOWmodules/accounting/AccountingModule.ts2660 // Step 2: Invoice must be in a terminal state (CLOSED or CANCELLED)COMMENT
LOWmodules/accounting/AccountingModule.ts2672 // Step 3: Caller must be a targetCOMMENT
LOWmodules/accounting/AccountingModule.ts2682 // Step 4: CommunicationsModule must be availableCOMMENT
LOWmodules/accounting/AccountingModule.ts2692 // Step 5: Validate memo lengthCOMMENT
LOWmodules/accounting/AccountingModule.ts2702 // Step 6: Get frozen balancesCOMMENT
LOWmodules/accounting/AccountingModule.ts2927 // Step 1: Invoice must existCOMMENT
LOWmodules/accounting/AccountingModule.ts2934 // Step 2: Invoice must be in CANCELLED state (not CLOSED)COMMENT
LOWmodules/accounting/AccountingModule.ts2944 // Step 3: Caller must be a targetCOMMENT
LOWmodules/accounting/AccountingModule.ts2954 // Step 4: CommunicationsModule must be availableCOMMENT
LOWmodules/accounting/AccountingModule.ts2964 // Step 5: Validate reason and dealDescription lengthCOMMENT
LOWmodules/accounting/AccountingModule.ts6233 // Step 2: Write token_scan_stateCOMMENT
LOWmodules/accounting/AccountingModule.ts6240 // Step 3: Write INV_LEDGER_INDEXCOMMENT
LOWmodules/accounting/AccountingModule.ts366 // Step 1: Clear all in-memory stateCOMMENT
LOWmodules/accounting/AccountingModule.ts437 // Step 4: Load terminal setsCOMMENT
LOWmodules/accounting/AccountingModule.ts454 // Step 5: Load frozen balancesCOMMENT
LOWmodules/accounting/AccountingModule.ts489 // Step 6: Load auto-return settingsCOMMENT
LOWmodules/accounting/AccountingModule.ts808 // Step 1: Validate CreateInvoiceRequest (§8.1)COMMENT
52 more matches not shown…
Hallucination Indicators7 hits · 70 pts
SeverityFileLineSnippetContext
CRITICALtests/unit/modules/SwapModule.storage.test.ts80 const setCallKeys = mocks.storage.set.mock.calls.map((c: any[]) => c[0] as string);CODE
CRITICALtests/unit/modules/SwapModule.storage.test.ts85 const swapRecordCall = mocks.storage.set.mock.calls.find(CODE
CRITICALtests/unit/modules/SwapModule.storage.test.ts160 const indexCall = mocks.storage.set.mock.calls.find(CODE
CRITICALtests/unit/modules/SwapModule.storage.test.ts250 const removeCallKeys = mocks.storage.remove.mock.calls.map((c: any[]) => c[0] as string);CODE
CRITICALtests/unit/modules/SwapModule.lifecycle.test.ts133 const calledEvents = mocks.accounting.on.mock.calls.map((call: any[]) => call[0]);CODE
CRITICALtests/unit/modules/SwapModule.lifecycle.test.ts152 const accountingUnsubs = mocks.accounting.on.mock.results.map((r: any) => r.value);CODE
CRITICAL…odules/AccountingModule.payInvoice-provisional.test.ts378 const setCallsDuring = mocks.storage.set.mock.calls.slice(setCallsBefore);CODE
Hyper-Verbose Identifiers67 hits · 66 pts
SeverityFileLineSnippetContext
LOWconstants.ts161export function isNetworkScopedAddressKey(key: string): boolean {CODE
LOWimpl/nodejs/transport/index.ts29export function createNodeWebSocketFactory(): WebSocketFactory {CODE
LOWimpl/nodejs/transport/index.ts42export function createNostrTransportProvider(CODE
LOWimpl/nodejs/ipfs/index.ts23export function createNodeIpfsStorageProvider(CODE
LOWimpl/nodejs/oracle/index.ts77export function createNodeTrustBaseLoader(CODE
LOWimpl/nodejs/oracle/index.ts91export function createUnicityAggregatorProvider(CODE
LOWimpl/nodejs/storage/FileTokenStorageProvider.ts339export function createFileTokenStorageProvider(config: FileTokenStorageConfig | string): FileTokenStorageProvider {CODE
LOWimpl/nodejs/storage/FileStorageProvider.ts239export function createFileStorageProvider(config: FileStorageProviderConfig | string): FileStorageProvider {CODE
LOWimpl/shared/ipfs/ipns-record-manager.ts127export function verifySequenceProgression(CODE
LOWimpl/shared/wallet-api/WalletApiTokenStorageProvider.ts599export function createWalletApiTokenStorageProvider(CODE
LOWimpl/shared/wallet-api/WalletApiMailboxProvider.ts489export function createWalletApiMailboxProvider(CODE
LOWimpl/browser/transport/index.ts43export function createNostrTransportProvider(CODE
LOWimpl/browser/ipfs/index.ts26export function createBrowserIpfsStorageProvider(config?: IpfsStorageConfig): IpfsStorageProvider {CODE
LOWimpl/browser/oracle/index.ts77export function createBrowserTrustBaseLoader(CODE
LOWimpl/browser/oracle/index.ts91export function createUnicityAggregatorProvider(CODE
LOWimpl/browser/storage/IndexedDBTokenStorageProvider.ts631export function createIndexedDBTokenStorageProvider(CODE
LOWimpl/browser/storage/IndexedDBStorageProvider.ts404export function createIndexedDBStorageProvider(CODE
LOWimpl/browser/storage/LocalStorageProvider.ts267export function createLocalStorageProvider(CODE
LOWimpl/browser/connect/ExtensionTransport.ts30export function isExtensionConnectEnvelope(data: unknown): data is ExtensionConnectEnvelope {CODE
LOWtypes/txf.ts311export function forkedKeyFromTokenIdAndState(tokenId: string, stateHash: string): string {CODE
LOWcore/crypto.ts418export function generateAddressFromMasterKey(CODE
LOWcore/crypto.ts556export function recoverPubkeyFromSignature(message: string, signature: string): string {CODE
LOWcore/delivery-envelope.ts67export function deriveDeliveryEncryptionKey(privKeyHex: string, peerPubkeyHex: string): Uint8Array {CODE
LOWcore/transport-resolver.ts71export function createTransportAddressResolver(CODE
LOWwallet-api/codec.ts273export function parsePaymentRequestRecord(raw: unknown, what: string): PaymentRequestRecord {CODE
LOWserialization/txf-serializer.ts71export function normalizeSdkTokenToStorage(sdkTokenJson: unknown): TxfToken {CODE
LOWserialization/txf-serializer.ts637export function hasUncommittedTransactions(token: Token): boolean {CODE
LOWserialization/txf-serializer.ts665export function countCommittedTransactions(token: Token): number {CODE
LOWserialization/wallet-text.ts162export function serializeEncryptedWalletToText(params: {CODE
LOWserialization/wallet-text.ts316export function parseAndDecryptWalletText(CODE
LOWserialization/wallet-dat.ts254function findEncryptedKeyForDescriptor(CODE
LOW…ts/unit/impl/shared/ipfs/ipfs-storage-provider.test.ts681 async function createInitializedProvider(): Promise<IpfsStorageProvider> {CODE
LOW…/unit/transport/NostrTransportProvider.nametag.test.ts20function deriveNametagEncryptionKey(privateKeyHex: string): Uint8Array {CODE
LOWtests/unit/transport/NostrTransportProvider.test.ts545 function createProviderWithStorage(storage: { get: ReturnType<typeof vi.fn>; set: ReturnType<typeof vi.fn> }) {CODE
LOWtests/unit/core/Sphere.nametag-sync.test.ts311 function createMockTransportWithRecovery(options: {CODE
LOWtests/unit/modules/swap-test-helpers.ts94export function createMockAccountingModule(): MockAccountingModule {CODE
LOWtests/unit/modules/swap-test-helpers.ts204export function createMockCommunicationsModule(): MockCommunicationsModule {CODE
LOWtests/unit/modules/swap-test-helpers.ts266export function createMockStorageProvider(): MockStorageProvider {CODE
LOWtests/unit/modules/swap-test-helpers.ts638export function createMockAnnounceResultDM(swapId: string, depositInvoiceId?: string): string {CODE
LOWtests/unit/modules/swap-test-helpers.ts657export function createMockInvoiceDeliveryDM(CODE
LOWtests/unit/modules/swap-test-helpers.ts711export function createMockSwapCancelledDM(CODE
LOWtests/unit/modules/swap-test-helpers.ts745export function createMockPaymentConfirmationDM(swapId: string, party?: string): string {CODE
LOWtests/unit/modules/swap-test-helpers.ts761export function createMockBounceNotificationDM(CODE
LOW…ts/unit/modules/AccountingModule.autoTerminate.test.ts72function makeIncomingTransferWithDirection(CODE
LOW…s/unit/modules/AccountingModule.deliveryOrders.test.ts123function tokenInvoiceMapEntriesFor(CODE
LOW…odules/AccountingModule.payInvoice-provisional.test.ts82function makeTermsWithWalletAsTarget(overrides?: Partial<InvoiceTerms>): InvoiceTerms {CODE
LOW…ts/unit/modules/PaymentsModule.journey-backlog.test.ts313function persistentLocalTokenStorage(cell: { data: TxfStorageDataBase | null }): TokenStorageProvider<TxfStorageDataBaseCODE
LOWtests/unit/modules/accounting-test-helpers.ts263export function createMockStorageProvider(): MockStorageProvider {CODE
LOWtests/unit/modules/accounting-test-helpers.ts333export function createMockTokenStorageProvider(): MockTokenStorageProvider {CODE
LOWtests/unit/modules/accounting-test-helpers.ts407export function createMockCommunicationsModule(): MockCommunicationsModule {CODE
LOWtests/unit/modules/accounting-test-helpers.ts831export function createTestAccountingModule(overrides?: {CODE
LOWtests/contract/storage-provider.contract.ts35export function describeStorageProviderContract(CODE
LOWtests/contract/delivery-provider.contract.ts85export function describeDeliveryProviderContract(CODE
LOWtests/integration/swap-lifecycle.test.ts561function configureAccountingForDeposit(CODE
LOWtests/integration/swap-lifecycle.test.ts599function configureAccountingForPayout(CODE
LOWtests/integration/wallet-clear-indexeddb.test.ts142function simulateStrictModeLeakedConnection(dbName: string): Promise<IDBDatabase> {CODE
LOWtests/harness/fake-differential.test.ts38async function assertServedByRealObjectStore(CODE
LOWtoken-engine/unicity-id.ts136export function createUnicityIdMinterFromDeps(deps: UnicityIdMinterDeps): IUnicityIdMinter {CODE
LOWmodules/accounting/memo.ts389export function parseInvoiceMemoForOnChain(CODE
LOWmodules/accounting/balance-computer.ts131function getOrCreateSenderAcc(CODE
7 more matches not shown…
Over-Commented Block58 hits · 46 pts
SeverityFileLineSnippetContext
LOWtsup.config.ts1import { defineConfig } from 'tsup';COMMENT
LOWtsup.shared.js1// Shared tsup build configuration (sphere-sdk#548).COMMENT
LOWindex.ts341 // NetworksCOMMENT
LOWindex.ts561// Master-key provider status re-export (already re-exported via ./types barrel,COMMENT
LOWimpl/shared/wallet-api/WalletApiMailboxProvider.ts221 // S6: bundle the sender's nametag + memo into ONE recipient-addressedCOMMENT
LOWimpl/shared/wallet-api/WalletApiMailboxProvider.ts261 stateHash: keys.stateHash,COMMENT
LOWcore/Sphere.ts2401 // wallet-api JWT, clear caches, and cause needless network traffic + inventoryCOMMENT
LOWcore/Sphere.ts2541 // own clients in the background.COMMENT
LOW…sts/unit/impl/browser/IndexedDBStorageProvider.test.ts181 });COMMENT
LOW…nit/impl/browser/IndexedDBTokenStorageProvider.test.ts221 expect(countTokens(load.data!)).toBe(0);COMMENT
LOW…ransport/MultiAddressTransportMux.sharedClient.test.ts441 // the host transport). The Mux did NOT construct a second.COMMENT
LOWtests/unit/modules/SwapModule.errors.test.ts181 // =========================================================================COMMENT
LOWtests/unit/modules/SwapModule.manifest.test.ts201 // This ensures the client SDK produces the same swap_id as the escrow serviceCOMMENT
LOW…s/unit/modules/AccountingModule.deliveryOrders.test.ts441 // design — see _handleIncomingTransfer). This protects against aCOMMENT
LOWtests/unit/modules/AccountingModule.events.test.ts781 //COMMENT
LOW…odules/AccountingModule.payInvoice-provisional.test.ts401 });COMMENT
LOWtests/unit/modules/SwapModule.deposit.test.ts221 // UT-SWAP-DEP-009 — Regression: party-currency vs. asset-position skewCOMMENT
LOW…/contract/wallet-api-mailbox-provider.contract.test.ts141COMMENT
LOWtests/integration/swap-lifecycle.test.ts1001 expect(idsB.size).toBe(3);COMMENT
LOWtests/integration/swap-lifecycle.test.ts1181 // swap to 'completed' — exercises the direct-mutation `completed → failed`COMMENT
LOWtests/integration/kv-network-isolation-extra.test.ts181 // enumeration — getFullKey('') resolves to the bare base prefix ('sphere_'),COMMENT
LOWtests/integration/sphere-network-isolation.e2e.test.ts221 (Sphere as unknown as { instance: Sphere | null }).instance = null;COMMENT
LOWtests/integration/wallet-password.test.ts221 // De-flake regression: an unauthenticated AES-CBC decrypt with the WRONGCOMMENT
LOWtests/harness/live/live-address-switch-strand.test.ts261 // A sends a VALID slice to B: a REAL split/mint certified by the gateway, theCOMMENT
LOWtests/support/fake-wallet-api.ts1061 // §5.3 step 2 — validate every added blob through the §8.2 pipelineCOMMENT
LOWdocs/CONNECT.md321COMMENT
LOWmodules/accounting/serialization.ts61 // Build the canonical object with keys in strict alphabetical order.COMMENT
LOWmodules/accounting/AccountingModule.ts501 // ------------------------------------------------------------------COMMENT
LOWmodules/accounting/AccountingModule.ts621 try { this.unsubscribeDMs?.(); } catch { /* ignore */ }COMMENT
LOWmodules/accounting/AccountingModule.ts1301 // Step 4: Check for duplicate (token already imported)COMMENT
LOWmodules/accounting/AccountingModule.ts1341 }COMMENT
LOWmodules/accounting/AccountingModule.ts1401 this.balanceCache.delete(hashedKey);COMMENT
LOWmodules/accounting/AccountingModule.ts2781 // Per the InvoiceReceiptAsset type, we use netBalance as netAmount.COMMENT
LOWmodules/accounting/AccountingModule.ts3941 // payouts. Without this branch, post-restartCOMMENT
LOWmodules/accounting/AccountingModule.ts3961 }COMMENT
LOWmodules/accounting/AccountingModule.ts4341 // an mt: entry IF an on-chain entry already exists, but theCOMMENT
LOWmodules/accounting/AccountingModule.ts4481COMMENT
LOWmodules/accounting/AccountingModule.ts4621 paymentDirection = ref.paymentDirection;COMMENT
LOWmodules/accounting/AccountingModule.ts4661 confirmed,COMMENT
LOWmodules/accounting/AccountingModule.ts4681 // that haven't graduated to a real invoice import within the TTL.COMMENT
LOWmodules/accounting/AccountingModule.ts4741 // for this invoiceId. The counter is also re-checked INSIDE theCOMMENT
LOWmodules/accounting/AccountingModule.ts4781 }COMMENT
LOWmodules/accounting/balance-computer.ts481 entry.coinId,COMMENT
LOWmodules/payments/PaymentsModule.ts1301 chainPubkey: deps.identity.chainPubkey,COMMENT
LOWmodules/payments/PaymentsModule.ts1621 // the next poll tick). Scheduled on a TRACKED macrotask so destroy()COMMENT
LOWmodules/payments/PaymentsModule.ts1761 // Use mutable result for building the transferCOMMENT
LOWmodules/payments/PaymentsModule.ts1781 // #664). We still throw (keep-open + resume is the exit), but re-tag theCOMMENT
LOWmodules/payments/PaymentsModule.ts1921 // On-chain memo: the structured invoice ref ({inv:{id,dir}}) for invoiceCOMMENT
LOWmodules/payments/PaymentsModule.ts2121COMMENT
LOWmodules/payments/PaymentsModule.ts2221 } catch (error) {COMMENT
LOWmodules/payments/PaymentsModule.ts2261 // it manually);COMMENT
LOWmodules/payments/PaymentsModule.ts4141 * path) — the in-session cache is left intact and the pull retries next load.COMMENT
LOWmodules/swap/SwapModule.ts1541 // sorts each target's assets by coinId hash for deterministic invoice IDs.COMMENT
LOWmodules/swap/SwapModule.ts1821 // Storage failure rollback. Note the partial-failure window:COMMENT
LOWmodules/swap/SwapModule.ts1901 if (!targetStatus.coinAssets[0].isCovered) {COMMENT
LOWmodules/swap/SwapModule.ts1961COMMENT
LOWmodules/swap/SwapModule.ts1981 // SECURITY: fail-CLOSED when payoutTokenIds is empty AND there areCOMMENT
LOWmodules/swap/SwapModule.ts2581 // Snapshot fields mutated before transitionProgress so we can fully revertCOMMENT
AI Slop Vocabulary1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUMtransport/NostrTransportProvider.ts246 // Create NostrClient with robust connection handling:COMMENT
Fake / Example Data2 hits · 2 pts
SeverityFileLineSnippetContext
LOWtests/unit/core/utils.test.ts222 expect(extractFromText(text, pattern)).toBe('John Doe');CODE
LOWtests/unit/token-engine/FakeTokenEngine.ts298// fake-token state: CBOR array[ tokenId, stateId, owner, genesisData?, transferMemo? ]COMMENT