AGENT SKILL

desktop-process-boundary-design

Design the privileged/sandboxed process split for a desktop application — enumerate the IPC surface as a deliberate API, place local storage and define offline authority, and specify background work and system integration such as tray, native menus, and global shortcuts.

License 许可
Apache-2.0
所属仓库
cwik-tech/octopus
最近更新
2026-10-27
Stars
★ 0
Forks
0

01 前言 Front Matter

name
desktop-process-boundary-design
description
Design the privileged/sandboxed process split for a desktop application — enumerate the IPC surface as a deliberate API, place local storage and define offline authority, and specify background work and system integration such as tray, native menus, and global shortcuts.

03 SKILL.md 正文

Desktop Process Boundary Design

Purpose

In a desktop application the process boundary is the trust boundary. Every IPC channel is a privilege grant from the view layer into the native layer. This skill produces a deliberate, enumerable boundary rather than one that accretes as features are added.

Use this skill once the runtime is selected and the conversation turns to what runs where.

Step 1 — Establish the Privilege Model

Name the processes and what each is trusted to do.

  • Privileged process. Electron main, or Tauri core. Holds filesystem access, network privileges beyond the webview, process spawning, native OS integration, and secrets. This is the code that must be reviewed as security-critical.
  • View process. Electron renderer, or Tauri webview. Treat as untrusted. Assume any code that reaches it — including transitive dependencies — can call any exposed IPC channel.
  • Preload or bridge layer. Where present, this is the only place the two meet. It should expose a narrow, explicit, typed API and nothing else.

State the sandbox posture explicitly: context isolation, node integration, and allowed origins for Electron; capability and allowlist configuration for Tauri. Defaults are not a decision — name them.

Step 2 — Enumerate the IPC Surface

Do not describe IPC as "the renderer talks to main." Produce a table. Every row is a privilege grant.

Channel Direction Privilege granted Why necessary Input validation
example: file.readProject view → privileged reads within project dir open a user project path confined to selected root

Rules for the surface:

  • Enumerate, never open. No generic invoke(anything) passthrough, no dynamic method dispatch from the view layer.
  • Domain verbs, not primitives. Expose saveDocument, not writeFile. A filesystem primitive on the bridge is a filesystem grant to anything running in the view.
  • Validate at the boundary. Every input crossing into the privileged process is untrusted. Validate shape and constrain paths, URLs, and identifiers.
  • Justify each row. If necessity cannot be stated in one sentence, the channel probably should not exist.

A long table is a signal. If the surface has dozens of channels, the boundary is likely in the wrong place — reconsider what should live natively.

Step 3 — Place Local Storage and Define Authority

Decide what lives on the device and what authority it carries.

  • Storage mechanism. Named options with rationale: embedded database file, structured files on disk, OS keychain or credential store for secrets, platform app-data directories for configuration. Never store secrets in webview-accessible storage.
  • Location. Use platform app-data conventions rather than hardcoded paths. This is one of the first places macOS and Windows diverge.
  • Authority. State plainly which data is authoritative locally and which is a cache of a remote source. Ambiguity here produces reconciliation bugs that surface months later.
  • Reconciliation. For anything both local and remote: what happens on conflict? Last-write-wins, server-authoritative, merge, or user-resolved. Pick one per data class and say so.
  • Offline envelope. State what works with no network and for how long. "Offline-first" is not a design — the list of operations that function offline is.

Step 4 — Background Work and System Integration

Specify the behaviors that make the application feel native, and where each one is implemented.

  • Background execution. What runs when no window is visible? Sync, watchers, scheduled work, notification polling. State whether the app quits on last-window-close or persists.
  • Tray residency. Whether the app lives in the tray or menu bar, what the menu contains, and what clicking does. Note that macOS menu bar and Windows system tray carry different user expectations — this is a divergence point, not a shared component.
  • Native menus. Application menu structure, and whether it is shared or platform-specific. macOS expects an application menu with conventional item placement; Windows does not.
  • Global shortcuts. Registered accelerators, conflict handling, and permission implications.
  • Window and lifecycle behavior. Multi-window model, state restoration, close-versus-quit semantics, deep link and protocol handling.
  • Notifications. Which layer emits them and what permissions each platform requires.

For every item, name the process it lives in. Background work in the view layer stops when the window closes — that is usually a bug in waiting.

Step 5 — Boundary Review

Before handing off, check:

  • Can any single compromised dependency in the view layer reach the filesystem, the network beyond intended origins, or secrets?
  • Is every IPC channel justified in one sentence?
  • Is offline authority stated per data class rather than as a slogan?
  • Does any background behavior depend on a window being open when it should not?
  • Are secrets outside webview-accessible storage?

Anti-Patterns

  • A generic bridge that forwards arbitrary calls into the privileged process.
  • Exposing filesystem or shell primitives rather than domain operations.
  • Disabling context isolation or widening the allowlist for convenience during development and never narrowing it.
  • Treating "offline-first" as a property rather than an enumerated set of operations.
  • Building tray and menu behavior as one shared abstraction across macOS and Windows.
  • Storing tokens or keys in webview-accessible storage instead of the OS credential store.

Output

  • Process and privilege model with explicit sandbox posture.
  • Enumerated IPC table with justification and validation per channel.
  • Storage placement, authority per data class, and reconciliation rules.
  • Offline operation envelope.
  • Background work and system integration, each assigned to a process.
  • Boundary review findings.

04 同仓库更多 Skills

cwik-tech
cwik-tech/octopus

twenty-year-land-plan

Apply the Bren discipline of evaluating every land and development decision on a twenty-year horizon, with a comprehensive plan for how the land, the community, and the surrounding public infrastructure evolve together. Deals optimized for a five-year exit are structurally different from deals that compound across generations; insist on knowing which kind you are making. Use when evaluating land, entitlements, master-planned development, or phasing decisions, and when separating five-year exit deals from generational holds.

★ 0
cwik-tech
cwik-tech/octopus

thematic-gut-check

Apply the Gray discipline of identifying the structural theme behind every real estate deal, testing where that theme sits in its capital-flow lifecycle, and insisting that deals without a named theme — or deals late in a crowded theme — clear a higher bar. A mediocre deal in a strong theme usually beats a clever deal in a weak one. Use when naming the structural thesis behind a deal, judging whether that theme is early or crowded, and setting the bar the deal must clear.

★ 0
cwik-tech
cwik-tech/octopus

supply-pipeline-gut-check

Apply the Zell discipline of grounding every real estate thesis in the local supply pipeline. Demand counts over adjectives — units under construction, units permitted, units proposed — and convert them into a forward absorption schedule. A deal that ignores the pipeline is a bet on a market you have not actually studied. Use when validating a market thesis, forecasting absorption and rent growth, or counting units under construction, permitted, and proposed.

★ 0
cwik-tech
cwik-tech/octopus

ruin-scenario-mapping

Apply the Taleb discipline of identifying, for every real estate deal, the specific chain of events that produces ruin — permanent, unrecoverable capital loss — and verifying that no single such chain has non-trivial probability. Deals with any plausible ruin path must be restructured or abandoned. Use when sizing leverage, testing refinancing, covenant, and liquidity risk, or checking whether any single failure chain can permanently wipe out the position.

★ 0
cwik-tech
cwik-tech/octopus

revenue-cost-architecture

Design a venture's revenue streams, pricing logic, cost structure, and unit economics so the business model has a coherent theory of value capture, not just value creation. Use after the value proposition and customer segment are set and before financial projections, when choosing a pricing model, calculating contribution margin or CAC payback, or checking whether the unit economics hold at scale.

★ 0
cwik-tech
cwik-tech/octopus

replacement-cost-stress-test

Apply the Buffett discipline of pricing every real estate asset against the cost to rebuild it from scratch. The ratio of purchase price to replacement cost sets a ceiling on long-run downside: below replacement cost, new supply cannot profitably undercut you; at or above it, you are buying a liability disguised as an asset. Use when setting a purchase price, judging downside protection, or testing how exposed an asset is to newly built competing supply.

★ 0