A file is an app. Everything is a file.
Selfware defines a unified file protocol for the Agent era: within the same distributable unit (a single file or a
.selfpackage), data, logic, and views MAY be bundled together; through distributed, decentralized Agent collaboration and self-contained human–machine interaction, it forms collaboration relationships between human↔Agent and Agent↔Agent; returning files to users so they never become obsolete and can evolve indefinitely.
Version: 0.1.0 (Draft)
License (Optional): MIT — you MAY modify, redistribute, and create derivatives.
Edition note (Non‑Normative):
selfware.mdandselfware.en.mdare the v0.1.0 Draft bilingual editions of the Selfware protocol. We aim to keep them in sync; if you find a mismatch, please open an issue or PR.
Unless marked as “Non‑Normative”, this document uses RFC-style terms:
Selfware does not require that a “protocol/app” must be authored as a single file. Instead, it requires that every Selfware instance explicitly declares and strictly follows its Canonical Data Source.
For a Selfware instance, the source of truth (Canonical Data) MUST come from exactly one of these two sources:
content/ scope (the default write scope).manifest.md (e.g., an http(s)/git pointer), with sync/cache/merge policy defined by the runtime (and still subject to No Silent Apply + rollback requirements).Constraints (MUST):
content/ (or an equivalent canonical landing scope declared by the manifest) and be rollbackable; remote changes MUST NOT be silently applied without user confirmation.Compared to traditional software: traditional software usually separates “data” and “logic/view”, where logic and view are controlled by a small number of vendors via closed clients/services, creating a de‑facto monopoly over files and ecosystems. Selfware removes this monopoly by allowing data + logic + views to optionally live in the same file (or the same distributable package) and by enabling decentralized running and distribution. The protocol itself is optionally MIT‑licensed: you can modify, redistribute, and create derivatives. This is a unified file protocol for the Agent era.
In this demo, Canonical Data is:
content/selfware_demo.md (text/Markdown; read/edit/save from the front-end)Notes:
content/ is the instance’s canonical data scope / default write scope. Collaboration, saving, merging, etc. default to writing here.manifest.md as a fetch/sync source for its Canonical Data.Remote Canonical Data (examples; examples only; not defaults):
Remote Canonical: https://floatboat.ai/selfware.mdRemote Canonical: git:https://github.com/floatboatai/selfware.mdImplementation constraints (MUST):
Selfware allows Canonical Data to be any type (non‑exhaustive):
An implementation MUST define the read/write shape of Canonical Data (text, byte stream, or a named resource set).
Any view MUST be treated as a function:
View = f(Data, Intent, Rules)
Where:
Data comes from Canonical DataRules are defined by this file (or extensions allowed by this file)The Kernel MUST bind to loopback only (localhost/127.0.0.1/::1) unless the user explicitly configures a wider boundary.
This demo’s API:
GET /api/content -> { "content": "<content/selfware_demo.md>" }POST /api/save with { "content": "<content/selfware_demo.md>" } -> { "status": "success" }GET /api/self -> { "path": "...", "sha256": "...", "content": "<content/selfware_demo.md>" }GET /api/manifest -> { "content": "<manifest.md>" }GET /api/capabilities -> runtime capability declaration (see 4.1)GET /api/check_update?url=... -> check whether a remote protocol source has updates (see 6)Write boundary (MUST):
POST /api/save MUST only write within content/ (canonical data scope)selfware.md unless the user has explicit intent and confirmationThe runtime MUST declare its capabilities so users and other Agents can understand boundaries and interaction.
The declaration MUST include at least:
write_scope: where writes are allowed (in this demo: content/)confirmation_required: actions that require user confirmation (e.g., pack, pull/merge, apply update, publish, send context)endpoints: available endpoints and their purpose (content R/W, update checks, packaging, etc.)modules: optional module status (e.g., whether git/discovery/self‑analysis is supported/enabled)The declaration MUST be exposed via at least one carrier:
GET /api/capabilities)Interaction constraints (MUST):
content/) and Change Record requirements.Example Discovery endpoint (example only; not a default):
https://floatboat.ai/discovery/https://github.com/awesome-selfware/awesome-selfware (a GitHub index repo for discovering Selfware/Skills/Practices ecosystem entries)Goal: with user permission, carry “intent + partial context” to discover better solutions (not just search).
A Discovery request SHOULD include:
update, recommend, fix_overflow, export_cards)Permissions (MUST):
Discovery responses MAY return (non‑exhaustive):
Discovery trigger points (runtime SHOULD; but MUST support explicit user trigger):
This file MAY declare an “official protocol source” (for update checks only; does not override local authority):
Protocol Source: https://floatboat.ai/selfware.mdProtocol Source (GitHub): https://github.com/floatboatai/selfwareIf update checking is enabled, the runtime MUST check at one of:
Checks SHOULD use ETag/Last‑Modified or content hashes. This demo provides /api/check_update and a diff summary.
If an update is detected, the runtime MUST:
Selfware local files SHOULD use Git for versioning (local repo is sufficient; remote optional):
Beyond local versioning, Selfware MAY configure a collaboration backend for multi‑person sync. The backend does not change the definition of selfware.md as protocol authority. Writes land in content/.
An instance (especially content/) MAY collaborate via Git (remote optional, e.g. GitHub):
Collaboration: gitRemote: <git remote url>Ref: <branch|tag|commit> (optional; default main/master is implementation-defined)If Git collaboration is enabled, the runtime MUST:
Selfware MAY use a custom collaboration service:
Collaboration: customEndpoint: <service url>Regardless of backend:
content/ or an explicitly allowed subset)selfware.md MUST be preceded by user confirmation and explanation (per 6.3).self container)A .self file MUST be a ZIP container (compatibility first; it must be unpackable by standard unzip tools).
Inside, it MUST include:
self/manifest.mdself/manifest.md MUST include at least:
Selfware-Container: zipSelfware-Container-Version: 1Protocol-Source: https://floatboat.ai/selfware.md (example; replaceable)Local-Protocol-Path: selfware.mdCanonical-Data-Scope: content/The protocol MAY evolve to new container types/versions; implementations MUST handle compatibility via Selfware-Container-Version or fail explicitly.
Packing is writing a Selfware project directory into a .self container. Implementations MUST:
.self, MUST show:
*.self)selfware.md. If self/manifest.md is generated, generate it inside the container without writing back to the repo (unless user explicitly requests).Default excludes (SHOULD as a safety baseline; instances MAY override/extend):
.DS_Store__pycache__/, *.pycnode_modules/, .venv/dist/, build/output/, *.log, *.tmp.git/ (unless user explicitly includes)The pack protocol (format + policy) is defined by this file.
An instance’s “pack plan” SHOULD live in an instance self-description file (e.g., manifest.md, or a dedicated section inside Canonical Data) to:
This demo places its pack plan in manifest.md.
To share a Selfware project, you SHOULD pack the whole directory into a ZIP and name it with a .self suffix (e.g., my_project.self).
Benefit: you share a “living document / living app”. If the receiver is a trusted collaborator and has access to the collaboration backend within your permission boundary (e.g., GitHub repo access), then when they open the Selfware they can check for updates and, after user confirmation, pull/merge to stay aligned with the latest version.
Memory is a set of auditable context files maintained under content/, used to:
Memory MUST NOT become the protocol authority; the protocol authority is selfware.md.
If enabled, instances SHOULD use:
content/memory/Implementations MAY use a single file (e.g., content/memory.md), but a multi-file structure is better for permission splitting and minimization.
Each Memory file MUST include metadata at the top explaining “who I am / what I record / how to update me”.
Two allowed formats:
---
selfware:
role: memory_chat | memory_changes | memory_decisions | memory_runs | custom
title: "..."
purpose: "..."
scope: "what is included / excluded"
update_policy: "append_only | editable | generated"
owner: "user | team | agent"
created_at: "YYYY-MM-DDThh:mm:ssZ"
updated_at: "YYYY-MM-DDThh:mm:ssZ"
---
## Meta section (same fields; key-value lines).For any change to any instance file (including content/, views/, server.py, manifest.md, etc.), the implementation MUST record a Change Record to content/memory/changes.md (or an equivalent location).
Each Change Record MUST include at least:
id (unique)timestampactor (user / agent / service)intentpaths (affected file list)summary (human-readable)rollback_hint (how to roll back: git ref / backup / manual steps)If Git is used locally, rollback_hint SHOULD point to a concrete Git rollback point (commit/tag/ref).
When Discovery carries context, Memory MAY be selectively referenced, but MUST:
The Ecosystem module defines how Selfware-related artifacts (skills, practices, selfware files, patches) are described, distributed, published, and consumed—without requiring a single centralized vendor.
An artifact MUST carry metadata including at least:
idtitletype (e.g., selfware / skill / practice / patch / view / template)versionprotocol_version_range (compatible Selfware protocol versions)applies_to (scope/platform/runtime)licensesha256 (content hash for verifiability)provenance (how it was derived; may include hashes)distribution (one or more distribution entries: hosted URL, index pointer, git url+ref, etc.)Optional fields (MAY):
trust (signing/publisher/verification info; not required, but implementations SHOULD be able to use it for local trust policy)distribution constraints (MUST):
git: pointer)Recommended distribution prefixes (SHOULD):
hosted: hosted content URLindex: index entry URLgit: decentralized pointer (e.g., repo#ref=...:path=...)sha256: explicit hash (same as metadata sha256)sha256 rules (MUST):
Publish:
Consume:
For decentralized ecosystem building and indexing, ecosystem repos SHOULD use top-level directories:
selfware/skills/practices/This convention is for “ecosystem repos” (publishing/sharing repos), not mandatory for normal .self instances.
Self‑Analysis is an optional module that extracts know‑how from an instance’s progress and changes, and—under user permission—closes an evolution loop with Discovery/ecosystem publishing.
This chapter defines only protocol boundaries and outputs; implementation details are runtime-specific and replaceable.
Self‑Analysis MAY read (non‑exhaustive):
content/selfware_demo.md)content/memory/changes.md, content/memory/decisions.md) if enabledmanifest.md (pack plan, runtime conventions)server.py, views/) for consistency/boundary scanningSelf‑Analysis MUST respect write boundaries: it MUST NOT bypass the protocol to write selfware.md; any writes MUST land within the instance’s allowed scope (in this demo: content/).
Self‑Analysis outputs MUST be materialized as files, auditable and rollbackable. Outputs MAY include:
sha256 and distribution drafts)Any output writes MUST be recorded as Change Records (see 10.3).
Self‑Analysis may trigger Discovery or publishing, but MUST:
Trigger points are implementation-defined (On Start / On User Request / On Significant Change, etc.). The protocol requires:
In this repository, views/, server.py, assets/, skills/ demonstrate a minimal loop: the same Markdown projected into multiple views + saved back.
The content/ directory is demo instance data (fixtures/experiments) and is the instance’s Canonical Data write scope, but it is not the protocol authority (the protocol authority is selfware.md).