Repository Analysis

unicity-sphere/sphere

A Web3 wallet and agent platform for the Unicity network - crypto wallet, DMs, group chat, and marketplace.

3.8 Likely human-written View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of unicity-sphere/sphere, a TypeScript project with 9,727 GitHub stars. SynthScan v2.0 examined 72,376 lines of code across 450 source files, recording 147 pattern matches distributed across 7 syntactic categories. The overall adjusted score of 3.8 places this repository in the Likely human-written 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).

3.8
Adjusted Score
3.8
Raw Score
100%
Time Factor
2026-08-28
Last Push
9.7K
Stars
TypeScript
Language
72.4K
Lines of Code
450
Files
147
Pattern Hits
2026-08-29
Scan Date
0.00
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 0HIGH 0MEDIUM 57LOW 90

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 147 distinct pattern matches across 7 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 Separators57 hits · 182 pts
SeverityFileLineSnippetContext
MEDIUMrun-sphere.sh17# ── App identity ─────────────────────────────────────────────────────────────COMMENT
MEDIUMrun-sphere.sh22# ── App networking ───────────────────────────────────────────────────────────COMMENT
MEDIUMrun-sphere.sh31# ── Source ssl-manager run library ───────────────────────────────────────────COMMENT
MEDIUMrun-sphere.sh41# ── App hooks ────────────────────────────────────────────────────────────────COMMENT
MEDIUMdeploy/runtime-config.sh46# ── Fail-closed (#351) ───────────────────────────────────────────────────────COMMENT
MEDIUMdeploy/runtime-config.sh71# ── Subscription flag sanity ─────────────────────────────────────────────────COMMENT
MEDIUMdeploy/runtime-config.sh84# ── AGGREGATOR_API_KEY requirement (conditional on subscriptions) ─────────────COMMENT
MEDIUMdeploy/runtime-config.sh101# ── Build the substitution program ───────────────────────────────────────────COMMENT
MEDIUMdeploy/runtime-config.sh116# ── Runtime config global (window.__SPHERE_RUNTIME_CONFIG__) ────────────────COMMENT
MEDIUMdeploy/runtime-config.sh158# ── Apply over the built JS (one sed program, all files) ─────────────────────COMMENT
MEDIUMdeploy/runtime-config.sh165# ── Content-Security-Policy ──────────────────────────────────────────────────COMMENT
MEDIUMdeploy/entrypoint.sh4# ── Export env so ssl-setup inherits our defaults ────────────────────────────COMMENT
MEDIUMdeploy/entrypoint.sh8# ── Normalize SSL_REQUIRED (fail closed on unknown values) ───────────────────COMMENT
MEDIUMdeploy/entrypoint.sh23# ── Validate env vars before use in nginx config ────────────────────────────COMMENT
MEDIUMdeploy/entrypoint.sh53# ── SSL setup (certs + HAProxy registration) ─────────────────────────────────COMMENT
MEDIUMdeploy/entrypoint.sh90# ── Generate nginx config ────────────────────────────────────────────────────COMMENT
MEDIUMdeploy/entrypoint.sh181# ── Graceful shutdown ────────────────────────────────────────────────────────COMMENT
MEDIUMdeploy/entrypoint.sh213# ── Runtime public config ────────────────────────────────────────────────────COMMENT
MEDIUMdeploy/entrypoint.sh220# ── Start nginx ──────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/e2e/two-profile-smoke.spec.ts229 // ── Onboard both profiles (A funds itself via open minting) ───────────COMMENT
MEDIUMtests/e2e/two-profile-smoke.spec.ts234 // ── A reloads (F5): minted balance must survive the full pull ─────────COMMENT
MEDIUMtests/e2e/two-profile-smoke.spec.ts237 // ── A sends 10 UCT to @B (mailbox delivery + B's claim/handoff) ───────COMMENT
MEDIUMtests/e2e/two-profile-smoke.spec.ts254 // ── B reloads (F5): received balance must survive the full pull ───────COMMENT
MEDIUMtests/e2e/two-profile-smoke.spec.ts257 // ── B requests 5 UCT from @A (§16 payment request) ────────────────────COMMENT
MEDIUMtests/e2e/two-profile-smoke.spec.ts272 // ── A pays it (payPaymentRequest: send + linked 'paid' respond) ───────COMMENT
MEDIUMtests/e2e/two-profile-smoke.spec.ts278 // ── Convergence: B holds 15 UCT, A holds 85 ───────────────────────────COMMENT
MEDIUMtests/e2e/perf-many-tokens.spec.ts93 // ── onboard ────────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/e2e/perf-many-tokens.spec.ts135 // ── top up N times: each mint is one more UCT source token ────────────────COMMENT
MEDIUMtests/e2e/perf-many-tokens.spec.ts145 // ── send the whole balance, which must consume every token ────────────────COMMENT
MEDIUMpublic/boot.js18 // ── GitHub Pages SPA path restore ────────────────────────────────────────COMMENT
MEDIUMpublic/boot.js35 // ── Theme, applied before first paint ────────────────────────────────────COMMENT
MEDIUMsrc/components/desktop/DesktopShortcuts.tsx30// ── Sortable wrappers ──────────────────────────────────────────────────COMMENT
MEDIUMsrc/hooks/useInstalledProjects.ts19// ── Local (offline / unauthenticated) cache of slugs ──────────────────COMMENT
MEDIUMsrc/hooks/useInstalledProjects.ts54// ── Hook ──────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/hooks/useInstalledProjects.ts117 // ── Mutations ───────────────────────────────────────────────────────COMMENT
MEDIUMsrc/pages/ExplorePage.tsx24// ─── Constants ────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/pages/ExplorePage.tsx50// ─── Featured Carousel ────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/pages/ExplorePage.tsx67// ─── Hero stat ────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/pages/ExplorePage.tsx89// ─── ExplorePage ──────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/pages/ProjectPage.tsx22// ── Helpers ──────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/pages/ProjectPage.tsx31// ── Drag-scrollable media strip ──────────────────────────────────────COMMENT
MEDIUMsrc/pages/ProjectPage.tsx104// ── Lightbox with keyboard + thumbnails ───────────────────────────────COMMENT
MEDIUMsrc/services/userApi.ts14// ── Types ─────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/services/userApi.ts51// ── JWT storage ───────────────────────────────────────────────────────COMMENT
MEDIUMsrc/services/userApi.ts65// ── Sign-in ───────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/services/userApi.ts121// ── Authenticated fetch ───────────────────────────────────────────────COMMENT
MEDIUMsrc/services/userApi.ts151// ── Installed-apps endpoints ──────────────────────────────────────────COMMENT
MEDIUMsrc/services/userApi.ts187// ── Ratings: recommend / helpful voting / replies ────────────────────COMMENT
MEDIUMsrc/services/userApi.ts226// ── Helpful voting on a specific rating ──────────────────────────────COMMENT
MEDIUMsrc/services/userApi.ts243// ── Replies (Telegram-style comments on a review) ────────────────────COMMENT
MEDIUMsrc/services/userApi.ts295// ── Moderation: report content, appeal a hide ────────────────────────COMMENT
MEDIUMsrc/services/marketplaceApi.ts5// ── Types ─────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/services/marketplaceApi.ts88// ── Fetch helpers ─────────────────────────────────────────────────────COMMENT
MEDIUMsrc/services/marketplaceApi.ts108// ── API functions ─────────────────────────────────────────────────────COMMENT
MEDIUMsrc/services/marketplaceApi.ts159// ── Public project metrics (live user/install/completion counts) ──────COMMENT
MEDIUMsrc/services/marketplaceApi.ts216// ── Public project ratings (Steam-style reviews) ──────────────────────COMMENT
MEDIUMsrc/services/marketplaceApi.ts250// ── Public reply thread for a single rating ───────────────────────────COMMENT
Over-Commented Block66 hits · 66 pts
SeverityFileLineSnippetContext
LOWrun-sphere.sh1#!/bin/bashCOMMENT
LOWdocker-compose.yml21 # Subscriptions (SGW) ship dormant; set exactly "true" to turn on.COMMENT
LOWdeploy/runtime-config.sh1#!/bin/shCOMMENT
LOWdeploy/runtime-config.sh21# SPHERE_API_URL quest-api base (marketplace / user / maintenance)COMMENT
LOWdeploy/runtime-config.sh161find "$WEBROOT" -type f -name '*.js' -exec sed -i -f "$SED_SCRIPT" {} \;COMMENT
LOWtests/unit/chat/DMChatSection.peerParam.test.tsx1import { describe, it, expect, vi, beforeEach } from 'vitest';COMMENT
LOWtests/unit/chat/DMChatSection.peerParam.test.tsx21// and they belong here, against the component a user can actually hit.COMMENT
LOWtests/unit/components/swapModalRates.test.tsx1import { describe, it, expect, vi, beforeEach } from 'vitest';COMMENT
LOWtests/unit/components/installedProjectIconSdk.test.tsx61 expect(openTab).toHaveBeenCalledWith('custom', { url: 'https://app.example.com', label: 'Agent Guild' });COMMENT
LOWtests/unit/components/installedProjectIconSdk.test.tsx201 });COMMENT
LOWtests/unit/sdk/gatewayErrors.test.ts81COMMENT
LOWpublic/boot.js41 // uses STORAGE_KEYS.THEME ('sphere_theme'), so the lookup always missed — and theCOMMENT
LOWpublic/runtime-config.js1// Default runtime config for dev / GitHub Pages builds: empty, so valuesCOMMENT
LOW.github/workflows/docker-build.yml41 push: trueCOMMENT
LOW.github/workflows/deploy-pages-branch.yml21# just-merged deploy was silently cancelled and staging kept the old bundle.COMMENT
LOW.github/workflows/deploy-pages-branch.yml101 run: npm run buildCOMMENT
LOW.github/workflows/deploy-pages-branch.yml121 # Aggregator API key — inlined into the bundle at build time.COMMENT
LOWsrc/config/storageKeys.ts41 // from identity via the SGW /auth flow). Cleared on wallet deletion.COMMENT
LOWsrc/utils/sentryScrub.ts21// 64+ hex chars: the shape of a raw private key (also matches sha256/txids —COMMENT
LOWsrc/utils/sentryScrub.ts121COMMENT
LOWsrc/components/chat/dm/DMChatSection.tsx61 });COMMENT
LOWsrc/components/marketplace/ProjectCard.tsx21 // A chat agent is never installable — the API rejects an install call forCOMMENT
LOWsrc/components/marketplace/ProjectCard.tsx41 // mutually exclusive (both key off the same `type` field), so at most oneCOMMENT
LOWsrc/components/marketplace/ProjectReviewsSection.tsx81 const [appealComment, setAppealComment] = useState('');COMMENT
LOWsrc/components/agents/WalletRequiredBlocker.tsx21COMMENT
LOWsrc/components/agents/IframeAgent.tsx121 const host = hostRef.current;COMMENT
LOWsrc/components/desktop/InstalledProjectIcon.tsx41 setMenuOpen(false);COMMENT
LOWsrc/components/desktop/InstalledProjectIcon.tsx61 // migration was written to retire, and do it from stale localStorage dataCOMMENT
LOWsrc/components/desktop/InstalledProjectIcon.tsx101 // an entry that calls it — a non-https value gets no menu item at all,COMMENT
LOWsrc/components/desktop/DesktopLayout.tsx61 navigate(`/agents/custom?url=${encodeURIComponent(url)}`);COMMENT
LOWsrc/components/wallet/L3/modals/SendModal.tsx121 // Leaving confirm because the SEND started is the one exit that must NOTCOMMENT
LOWsrc/components/wallet/L3/modals/SendModal.tsx141 } | null>(null);COMMENT
LOWsrc/components/wallet/L3/modals/SendModal.tsx201 // It is armed by a callback ref on every control that can authorize a spend,COMMENT
LOW…mponents/wallet/L3/hooks/useIncomingPaymentRequests.ts141 const pay = useCallback(async (request: IncomingPaymentRequest) => {COMMENT
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts181 // (#449) so it doesn't have to re-click through the start screen.COMMENT
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts221 const [, setDetectedFileType] = useState<LegacyFileType>('unknown');COMMENT
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts521 // never threaded into the new on-disk mnemonic (verified against theCOMMENT
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts761 if (SUBSCRIPTION_ENABLED && active) {COMMENT
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts861 const handleBackupDownloadComplete = useCallback(() => {COMMENT
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts881 // In every case there is a real wallet on disk (with a token DB, etc.) byCOMMENT
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts901 // can encrypt the exported file with the SAME password — seeCOMMENT
LOWsrc/components/connect/ConnectIntentHandler.tsx101 // THE INVARIANT (ConnectContext.armIntentShield): the §8.4 settle windowCOMMENT
LOWsrc/components/connect/ConnectIntentHandler.tsx141COMMENT
LOWsrc/sdk/SphereProvider.tsx241 // its password this session — locked, not broken (#449). The SDK signalsCOMMENT
LOWsrc/sdk/SphereProvider.tsx261 const passwordOpBusyRef = useRef(false);COMMENT
LOWsrc/sdk/SphereProvider.tsx321 // toggle, unmount) destroys the instance it built instead of leaking it. SeeCOMMENT
LOWsrc/sdk/SphereProvider.tsx341 /** Rate-limits the persisted-unlock timestamp write; see the idle timer's onActivity. */COMMENT
LOWsrc/sdk/SphereProvider.tsx381 [],COMMENT
LOWsrc/sdk/SphereProvider.tsx601 setInitProgress(null);COMMENT
LOWsrc/sdk/SphereProvider.tsx721 // #449 no-wallet-loss guard: Sphere.init({autoGenerate:true}) onlyCOMMENT
LOWsrc/sdk/SphereProvider.tsx841 );COMMENT
LOWsrc/sdk/SphereProvider.tsx981COMMENT
LOWsrc/sdk/SphereProvider.tsx1001 try {COMMENT
LOWsrc/sdk/SphereProvider.tsx1021 forEachConnectHost((host) => host.setLocked());COMMENT
LOWsrc/sdk/SphereProvider.tsx1141 localStorage.setItem(STORAGE_KEYS.AUTO_LOCK_TIMEOUT, encodeLockSettings(value, password));COMMENT
LOWsrc/sdk/errors.ts61// The SINGLE source of truth for the send-pipeline error codes that mean theCOMMENT
LOWsrc/sdk/hooks/payments/useTransfer.ts121 // synthetic pending result below is returned in ALL cases,COMMENT
LOWsrc/sdk/hooks/payments/useTransfer.ts141 // Swallow everything: annotation is best-effort, money-safetyCOMMENT
LOWsrc/sdk/hooks/core/useSphereEvents.ts261 // - 'split:checkpoint-stuck' (sphere-sdk#501 / E.4): a certified split isCOMMENT
LOWsrc/pages/ExplorePage.tsx101 // the same status) never fire requests that would 503 during maintenance.COMMENT
6 more matches not shown…
Hyper-Verbose Identifiers20 hits · 20 pts
SeverityFileLineSnippetContext
LOWtests/unit/components/importPassword.test.tsx77async function driveRestoreToSetPassword() {CODE
LOWtests/unit/components/importPassword.test.tsx176 async function selectAndImportEncryptedFile() {CODE
LOWsrc/sphere-sdk-browser.d.ts67 export function createUnicityAggregatorProvider(CODE
LOWsrc/config/storageKeys.ts95export function getOrCreateWalletApiDeviceId(): string {CODE
LOWsrc/config/storageKeys.ts95export function getOrCreateWalletApiDeviceId(): string {CODE
LOWsrc/config/subscription.ts58function resolveSubscriptionApiUrl(): string {CODE
LOWsrc/components/chat/utils/groupChatHelpers.ts26export function getGroupFormattedLastMessageTime(group: GroupData): string {CODE
LOWsrc/components/chat/utils/groupChatHelpers.ts65export function getMessageSenderDisplayName(message: GroupMessageData): string {CODE
LOWsrc/components/layout/PendingTransfersIndicator.tsx41export function PendingTransfersIndicator() {CODE
LOWsrc/components/layout/WalletApiSessionIndicator.tsx18export function WalletApiSessionIndicator() {CODE
LOW…llet/onboarding/hooks/useOnboardingConnectionStatus.ts23export function useOnboardingConnectionStatus() {CODE
LOWsrc/components/connect/PaymentRequestIntentModal.tsx33export function PaymentRequestIntentModal({CODE
LOWsrc/components/connect/rejectionMessage.ts38function describeProtocolRejection(data: Record<string, unknown>): string {CODE
LOWsrc/sdk/SphereProvider.tsx191function readCurrentAutoLockMinutes(oldPassword: string | null): AutoLockValue {CODE
LOWsrc/sdk/errors.ts143function isJsonRpcNetworkErrorShape(CODE
LOWsrc/sdk/hooks/payments/useTransfer.ts23function disambiguateGatewayAuthError(openUpgrade: (reason?: UpgradeReason) => void): void {CODE
LOWsrc/hooks/useKeyboardScrollIntoView.ts13export function useKeyboardScrollIntoView(_inputRef: RefObject<HTMLElement | null>) {CODE
LOWsrc/hooks/useMarketplace.ts188export function useProjectMetricsByGroups(groups: string[][]) {CODE
LOWsrc/services/announcementsClient.ts41export function createAnnouncementsClient(getSphere: () => Sphere | null): AnnouncementsClient {CODE
LOWsrc/services/telemetry.ts94export function getOrCreateClientId(): string {CODE
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippetContext
LOWrun-sphere.sh5# Usage:COMMENT
Verbosity Indicators1 hit · 2 pts
SeverityFileLineSnippetContext
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts657 // Step 1: Check nametag availability via Nostr (no wallet needed)COMMENT
Structural Annotation Overuse1 hit · 2 pts
SeverityFileLineSnippetContext
LOW…omponents/wallet/onboarding/hooks/useOnboardingFlow.ts657 // Step 1: Check nametag availability via Nostr (no wallet needed)COMMENT
Fake / Example Data1 hit · 1 pts
SeverityFileLineSnippetContext
LOWtests/unit/utils/sentryScrub.test.ts51 expect(scrubText('Auth failed for user@example.com')).not.toContain('user@example.com');CODE