# akilanpl/notyourregularcompanian-nyrc- architecture

> Architecture diagram of the GitHub repository akilanpl/notyourregularcompanian-nyrc-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akilanpl/notyourregularcompanian-nyrc-
- Repository: https://github.com/akilanpl/notyourregularcompanian-nyrc-

## Overview

NYRC is a local-first desktop companion with an expressive character and optional assistant tools. Its main workflow runs from the user through the desktop interface and local request routing to host-side command handling, where permission checks gate sensitive actions and local storage or integrations perform the work. Separate branches cover character simulation, timers and reminders, optional AI and Calendar, and the shared body protocol. Some subsystem links are documented in the README; unsampled implementation details are not inferred.

Main entry points: [`src/lib/components/Pet.svelte`](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/components/Pet.svelte) (Companion interface), [`src-tauri/src/commands/services.rs`](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/services.rs) (Host commands), [`src/lib/assistant/router.ts`](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/assistant/router.ts) (Local request router), [`src/lib/assistant/runtime.ts`](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/assistant/runtime.ts) (Assistant runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_app["App routing<br/>[App.svelte]"]
  node_pet["Companion interface<br/>[Pet.svelte]"]
  node_assistant_input["Assistant input"]
end

subgraph group_companion["Companion experience"]
  node_personality["Personality settings<br/>[personality.rs]"]
  node_simulation["Character simulation<br/>[state.ts]"]
  node_expression["Expressions and reactions<br/>[expression.ts]"]
end

subgraph group_tasks["Assistant tools"]
  node_router["Local request router<br/>[router.ts]"]
  node_assistant_runtime["Assistant runtime<br/>[runtime.ts]"]
  node_task_manager["Task manager<br/>[taskManager.ts]"]
  node_timers["Timers and reminders<br/>[scheduled.rs]"]
  node_pocket["Pocket and memory<br/>[memory.rs]"]
end

subgraph group_host["Host services"]
  node_bridge["Desktop bridge<br/>[api.ts]"]
  node_commands["Host commands<br/>[services.rs]"]
  node_authority["Permission checks<br/>[authority.rs]"]
  node_database[("Local database<br/>[db.rs]")]
  node_sandbox["Restricted file access<br/>[sandbox.rs]"]
  node_ai["AI providers<br/>[cloud.rs]"]
  node_calendar["Google Calendar<br/>[calendar.rs]"]
end

subgraph group_bodies["Body integration"]
  node_body_api["Semantic body API<br/>[protocol.ts]"]
  node_body_transport["Loopback transport<br/>[body.rs]"]
  node_desktop_body["Desktop body<br/>[core.ts]"]
end

node_user(("User"))
node_external_ai["AI service"]
node_google["Google Calendar service"]

node_user -->|"opens"| node_app
node_app -->|"shows"| node_pet
node_user -->|"requests help"| node_assistant_input
node_assistant_input -.->|"routes locally"| node_router
node_router -.->|"resolves requests"| node_assistant_runtime
node_assistant_runtime -.->|"dispatches tasks"| node_task_manager
node_router -->|"handles reminders"| node_timers
node_assistant_runtime -.->|"calls host tools"| node_bridge
node_pet -->|"uses desktop API"| node_bridge
node_bridge -->|"invokes commands"| node_commands
node_commands -->|"checks approval"| node_authority
node_commands -->|"dispatches Calendar"| node_calendar
node_commands -->|"reads and writes"| node_database
node_commands -->|"reads Pocket files"| node_sandbox
node_commands -->|"uses configured provider"| node_ai
node_calendar -->|"requests events"| node_google
node_ai -.->|"sends AI requests"| node_external_ai
node_pet -->|"updates companion state"| node_simulation
node_simulation -.->|"drives reactions"| node_expression
node_pet -->|"uses body protocol"| node_body_api
node_body_api -.->|"uses transport"| node_body_transport
node_body_api -->|"renders on desktop"| node_desktop_body
node_pet -.->|"presents personality"| node_personality
node_pet -.->|"shows scheduled alerts"| node_timers
node_pet -.->|"offers saved items"| node_pocket

click node_app "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/App.svelte"
click node_pet "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/components/Pet.svelte"
click node_assistant_input "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/components/AssistantInput.svelte"
click node_router "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/assistant/router.ts"
click node_assistant_runtime "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/assistant/runtime.ts"
click node_task_manager "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/tasks/taskManager.ts"
click node_timers "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/scheduled.rs"
click node_pocket "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/memory.rs"
click node_bridge "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/bridge/api.ts"
click node_commands "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/services.rs"
click node_authority "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/authority.rs"
click node_database "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/db.rs"
click node_sandbox "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/sandbox.rs"
click node_ai "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/llm/cloud.rs"
click node_personality "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/personality.rs"
click node_simulation "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/sim/state.ts"
click node_expression "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/character/expression.ts"
click node_calendar "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/calendar.rs"
click node_body_api "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/body/protocol.ts"
click node_body_transport "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/body.rs"
click node_desktop_body "https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/body/core.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_pet,node_assistant_input,node_user toneBlue
class node_personality,node_simulation,node_expression toneAmber
class node_router,node_assistant_runtime,node_task_manager,node_timers,node_pocket toneMint
class node_bridge,node_commands,node_authority,node_database,node_sandbox,node_ai,node_calendar toneRose
class node_body_api,node_body_transport,node_desktop_body,node_external_ai,node_google toneIndigo
```

## Components

### Desktop interface

- [App routing](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/App.svelte): `src/App.svelte`
- [Companion interface](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/components/Pet.svelte): `src/lib/components/Pet.svelte`
- [Assistant input](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/components/AssistantInput.svelte): `src/lib/components/AssistantInput.svelte`

### Companion experience

- [Personality settings](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/personality.rs): `src-tauri/src/personality.rs`
- [Character simulation](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/sim/state.ts): `src/lib/sim/state.ts`
- [Expressions and reactions](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/character/expression.ts): `src/lib/character/expression.ts`

### Assistant tools

- [Local request router](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/assistant/router.ts): `src/lib/assistant/router.ts`
- [Assistant runtime](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/assistant/runtime.ts): `src/lib/assistant/runtime.ts`
- [Task manager](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/tasks/taskManager.ts): `src/lib/tasks/taskManager.ts`
- [Timers and reminders](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/scheduled.rs): `src-tauri/src/commands/scheduled.rs`
- [Pocket and memory](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/memory.rs): `src-tauri/src/commands/memory.rs`

### Host services

- [Desktop bridge](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/bridge/api.ts): `src/lib/bridge/api.ts`
- [Host commands](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/services.rs): `src-tauri/src/commands/services.rs`
- [Permission checks](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/authority.rs): `src-tauri/src/authority.rs`
- [Local database](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/db.rs): `src-tauri/src/db.rs`
- [Restricted file access](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/sandbox.rs): `src-tauri/src/sandbox.rs`
- [AI providers](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/llm/cloud.rs): `src-tauri/src/llm/cloud.rs`
- [Google Calendar](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/commands/calendar.rs): `src-tauri/src/commands/calendar.rs`

### Body integration

- [Semantic body API](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/body/protocol.ts): `src/lib/body/protocol.ts`
- [Loopback transport](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src-tauri/src/body.rs): `src-tauri/src/body.rs`
- [Desktop body](https://github.com/akilanpl/notyourregularcompanian-nyrc-/blob/main/src/lib/body/core.ts): `src/lib/body/core.ts`

### Other components

- **User**
- **AI service**
- **Google Calendar service**

## Connections

- User → App routing: opens (evidence: `README.md`)
- App routing → Companion interface: shows (evidence: `src/App.svelte`)
- User → Assistant input: requests help (evidence: `README.md`)
- Assistant input → Local request router: routes locally
- Local request router → Assistant runtime: resolves requests
- Assistant runtime → Task manager: dispatches tasks
- Local request router → Timers and reminders: handles reminders (evidence: `README.md`)
- Assistant runtime → Desktop bridge: calls host tools
- Companion interface → Desktop bridge: uses desktop API (evidence: `src/lib/components/Pet.svelte`)
- Desktop bridge → Host commands: invokes commands (evidence: `src/lib/bridge/api.ts`)
- Host commands → Permission checks: checks approval (evidence: `src-tauri/src/commands/services.rs`)
- Host commands → Google Calendar: dispatches Calendar (evidence: `src-tauri/src/commands/services.rs`)
- Host commands → Local database: reads and writes (evidence: `src-tauri/src/commands/services.rs`)
- Host commands → Restricted file access: reads Pocket files (evidence: `src-tauri/src/commands/services.rs`)
- Host commands → AI providers: uses configured provider (evidence: `src-tauri/src/commands/services.rs`)
- Google Calendar → Google Calendar service: requests events (evidence: `src-tauri/src/commands/calendar.rs`)
- AI providers → AI service: sends AI requests (evidence: `README.md`)
- Companion interface → Character simulation: updates companion state (evidence: `src/lib/components/Pet.svelte`)
- Character simulation → Expressions and reactions: drives reactions
- Companion interface → Semantic body API: uses body protocol (evidence: `src/lib/components/Pet.svelte`)
- Semantic body API → Loopback transport: uses transport (evidence: `README.md`)
- Semantic body API → Desktop body: renders on desktop (evidence: `README.md`)
- Companion interface → Personality settings: presents personality
- Companion interface → Timers and reminders: shows scheduled alerts
- Companion interface → Pocket and memory: offers saved items
