Skip to content

Lenses: Full governance, behavioral tracking, tests, Store-ready#3

Merged
RegardsKiki2 merged 5 commits intomainfrom
claude/neuroverse-readme-pUh8X
Mar 26, 2026
Merged

Lenses: Full governance, behavioral tracking, tests, Store-ready#3
RegardsKiki2 merged 5 commits intomainfrom
claude/neuroverse-readme-pUh8X

Conversation

@RegardsKiki2
Copy link
Copy Markdown
Contributor

@RegardsKiki2 RegardsKiki2 commented Mar 26, 2026

Summary

Complete build-out of Lenses as a governed, adaptive AI perspective companion for MentraOS smart glasses.

What shipped (11 commits)

Core Architecture

  • All imports use @neuroverseos/governance (extracted from monorepo, standalone repo)
  • simulateWorld() wired — governance engine runs after every AI call, rules fire, trust decays/recovers, gates transition
  • Gate-based invisible behavioral adjustments: ACTIVE (full), DEGRADED (60% words, 50% proactive), SUSPENDED (proactive off), REVOKED (AI blocked)

Behavioral Tracking Loop

  • AI outputs [MODE:tag] on every response (stripped before display, tracked in journal)
  • nextAction tracking: acted / delayed / switched / dropped — replaces raw dismissal boolean
  • Unified journal schema: signalEffectiveness, behaviorPatterns, modeEffectiveness, recentSignals
  • Journal persists via SimpleStorage (cross-session, ~200 bytes aggregate counts)
  • Dashboard shows: "72% led to action · you respond best to: pushback (80%) · clear advice (65%)"

Core Invariants

  • perspective_only — every response reframes through philosophy, never detects behavioral signals
  • no_signal_detection — no deception analysis, confidence scores, or signal labels. Enforced at prompt level, governance worldfile, AND kernel output boundary
  • 11 total invariants (all structural, immutable)

Governance Worldfile (lenses-app.nv-world.md)

  • 15 rules (structural, operational, degradation, recovery, advantage)
  • Trust recovery: rule-013 (+15% sustained clean use), rule-014 (+10% time-based cooldown)
  • Rule precedence: structural first → operational → recovery only if clean → advantage last
  • Gate transitions documented with specific rule triggers
  • 3 assumption profiles (standard, privacy_first, power_user)

UX

  • Max 50 words on glasses display (was 80). Nothing exceeds 50.
  • Voice tutorial: say "help" or "show me commands" — 4-step cycling guide on glasses
  • Active voice shown on every response header
  • Proactive responses labeled "unprompted" — user always knows AI spoke up on its own
  • Cost estimate on dashboard: "12 calls (~$0.012)"
  • Governance hint when trust drops: "Adjusting — try fewer, slower taps."
  • Human-readable mode labels: "pushback" not "challenge", "clear advice" not "direct"

Live Demo

  • npm run demo:live — real AI calls through compiled worldfiles
  • Multi-provider: set both ANTHROPIC_API_KEY + OPENAI_API_KEY for side-by-side comparison
  • --interactive mode with /switch, /compare, /prompt commands
  • --local mode — shows worldfile anatomy + governance invariants without API key

Store Blockers (all 5 fixed)

  • Dockerfile: fails on compile errors, non-root user, .dockerignore
  • API key config: type secret with description
  • SDK pinned to ^3.0.0 (was "latest")
  • Manifest: ai_can_act: "opt_in_only" with governance description
  • Apache 2.0 LICENSE

Tests + CI

  • src/governance.ts — pure logic extracted (zero external deps)
  • 40+ tests: mode extraction, gate classification, gate adjustments, signal resolution, behavioral insights, ambient buffer, journal creation
  • CI workflow runs vitest standalone (no npm ci dependency on @mentra/sdk)

README

  • Complete rewrite: worldfile anatomy, governance architecture, interaction model, behavioral tracking, live governance, demo modes, NeuroverseOS family

Philosophy worldfiles (10 traditions, all validated)

All have: thesis, 5-6 principles with before/after examples, 3-4 historical voices, 5 modes (direct/translate/reflect/challenge/teach), boundaries with clinical referrals, tone metadata.

Stoicism · ICF Coaching · Accountability · Mindfulness · Positive Psychology · Strategic Influence · Bushido · Socratic Method · CBT · Existentialism

Bug fixes

  • journal.totalLensesjournal.totalSignals (field didn't exist in new schema)
  • Undefined settings variable in onSession (runtime crash)
  • Stale duplicate JSDoc on loadJournal
  • Proactive classify timer race condition (session cleanup guard)

Test plan

  • npm run demo:live -- --local shows worldfile anatomy without API key
  • ANTHROPIC_API_KEY=... npm run demo:live produces different responses per voice
  • npm run validate passes all world + governance checks
  • Vitest: npx vitest run — 40+ tests pass
  • Governance: spam taps → responses shorten (DEGRADED gate)
  • Governance: clean use after spam → responses recover (trust recovery rules)
  • Core invariant: AI never outputs signal detection language (kernel boundary)

https://claude.ai/code/session_01VJskmFD8Lm4E4UfJpgHE2N

claude added 4 commits March 26, 2026 19:50
README fully updated to reflect everything shipped:
- Worldfile anatomy with required sections documented
- Governance worldfile: 15 rules, 4 gates, rule precedence, recovery
- Interaction model table (tap, hold, help, voice commands)
- Word limits: nothing exceeds 50 words on glasses display
- Behavioral tracking: MODE tags, nextAction, dashboard insights
- Live governance: simulateWorld(), gates, invisible adjustments
- Dashboard: cost estimate, human-readable mode labels, governance hints
- Demo modes: canned, live, multi-provider, interactive, local
- NeuroverseOS family: lenses + startalk + negotiator + governance engine
- Requirements: links to MentraOS SDK and governance repos
- BYO-Key: "Requires an AI API key" stated upfront, no apologies

Added Apache License 2.0 (matching @neuroverseos/governance).

https://claude.ai/code/session_01VJskmFD8Lm4E4UfJpgHE2N
New file: src/governance.ts
- Extracted all pure functions from server.ts into testable module
- Zero external dependencies — no SDK, no governance engine imports
- Exports: extractModeTag, classifyGate, gateAdjustments, resolveSignal,
  buildBehaviorInsight, purgeExpiredAmbient, hasRecentAmbient,
  getAmbientContext, buildFromNewest, createEmptyJournal
- All types exported: SignalRecord, LensJournal, AmbientBuffer,
  GovernanceGate, GovernanceState, ResponseMode, NextAction

New file: src/__tests__/governance.test.ts (Vitest)
- 40+ test cases covering:
  - extractModeTag: valid modes, invalid modes, missing tags, edge cases
  - classifyGate: all 4 thresholds, exact boundary values
  - gateAdjustments: ACTIVE/DEGRADED/SUSPENDED/REVOKED multipliers
  - resolveSignal: acted/delayed/switched/dropped, per-mode tracking,
    effectiveness math, rolling window cap at 50
  - buildBehaviorInsight: minimum signal threshold (5), human-readable
    labels, top-2 mode sorting, 3+ signal filter
  - Ambient buffer: purge expired, recency detection, word budget,
    newest-first building
  - createEmptyJournal: zero state, independent instances

New file: .github/workflows/ci.yml
- Runs on push and PR: typecheck → test → docker build
- Node 20, npm ci, minimal config

Note: Tests import only from src/governance.ts (zero external deps).
npm install fails locally because @mentra/sdk is an internal package.
Tests will pass in CI with access to Mentra's npm registry.

https://claude.ai/code/session_01VJskmFD8Lm4E4UfJpgHE2N
Lenses is a perspective companion, not a signal detector.
This distinction is now enforced at every layer:

Governance worldfile (lenses-app.nv-world.md):
- perspective_only: every response must reframe through philosophy.
  Never detect, classify, or label behavioral signals. That is the
  domain of other apps (Negotiator).
- no_signal_detection: no deception analysis, confidence scores,
  signal labels, or pattern detection. If user asks "are they lying?"
  the lens reframes through philosophy, never through analysis.

System prompt (philosophy-loader.ts):
- Added "Core Rule" section before Constraints: "You are a perspective
  companion. You NEVER detect, classify, or label behavioral signals."
- Enforced at the prompt level so the AI cannot cross the boundary.

Kernel output boundary (lenses-governance.ts):
- Added output-signal-detection pattern that blocks responses containing
  "deception detected", "inconsistency detected", "confidence: X",
  or signal classification syntax.

README:
- perspective_only and no_signal_detection added as top two invariants
  in the invariants table, bolded.

https://claude.ai/code/session_01VJskmFD8Lm4E4UfJpgHE2N
npm ci fails because @mentra/sdk is an internal package not on public
npm. The governance tests import only from src/governance.ts which has
zero external dependencies — so we install vitest standalone and run
tests without the full dependency chain.

Typecheck and Docker build jobs are commented out with instructions
to uncomment when CI has access to Mentra's internal npm registry.

https://claude.ai/code/session_01VJskmFD8Lm4E4UfJpgHE2N
@RegardsKiki2 RegardsKiki2 changed the title Claude/neuroverse readme p uh8 x Lenses: Full governance, behavioral tracking, tests, Store-ready Mar 26, 2026
…olution

npm install --no-save still reads package.json and tries to resolve
all dependencies including @mentra/sdk (internal package). Fix by
installing vitest into /tmp/test-runner with its own package.json,
then running it from there. Tests import only from src/governance.ts
which has zero external dependencies.

https://claude.ai/code/session_01VJskmFD8Lm4E4UfJpgHE2N
@RegardsKiki2 RegardsKiki2 merged commit 73037f6 into main Mar 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants