claude-multi-session 1.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +453 -0
- package/STRATEGY.md +306 -0
- package/bin/cli.js +1081 -18
- package/bin/continuity-hook.js +118 -0
- package/bin/setup.js +118 -63
- package/package.json +3 -2
- package/src/artifact-store.js +639 -0
- package/src/atomic-io.js +99 -0
- package/src/briefing-generator.js +451 -0
- package/src/continuity-hooks.js +253 -0
- package/src/contract-store.js +525 -0
- package/src/decision-journal.js +229 -0
- package/src/dependency-resolver.js +453 -0
- package/src/diff-engine.js +473 -0
- package/src/file-lock.js +161 -0
- package/src/index.js +26 -0
- package/src/lineage-graph.js +402 -0
- package/src/mcp-server.js +2062 -268
- package/src/pattern-registry.js +221 -0
- package/src/pipeline-engine.js +618 -0
- package/src/session-snapshot.js +508 -0
- package/src/snapshot-engine.js +490 -0
- package/src/stale-detector.js +169 -0
- package/src/team-hub.js +584 -0
package/README.md
CHANGED
|
@@ -540,6 +540,459 @@ See `STRATEGY.md` for the complete guide on:
|
|
|
540
540
|
- **Claude Code CLI** installed and authenticated
|
|
541
541
|
- Zero npm dependencies
|
|
542
542
|
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## Team Hub v2 — Multi-Session Collaboration
|
|
546
|
+
|
|
547
|
+
**Team Hub v2** transforms isolated Claude sessions into **self-organizing teams** that exchange structured data, auto-resolve dependencies, and heal themselves when things break. Instead of talking in natural language (which degrades over time), sessions coordinate through **versioned artifacts** and **formal contracts**.
|
|
548
|
+
|
|
549
|
+
This is the only multi-agent system for Claude Code that uses **transactional coordination** instead of conversational coordination.
|
|
550
|
+
|
|
551
|
+
### The Three-Layer Architecture
|
|
552
|
+
|
|
553
|
+
**Layer 1: Chat** — Sessions message each other directly (like Slack)
|
|
554
|
+
- Send DMs, broadcasts, and blocking ask/reply questions
|
|
555
|
+
- Check inbox before starting work, after major steps
|
|
556
|
+
- Rate-limited and loop-protected to prevent message storms
|
|
557
|
+
|
|
558
|
+
**Layer 2: Artifacts & Contracts** — Sessions exchange structured, versioned data (like Git + Jira)
|
|
559
|
+
- **Artifacts:** Immutable, versioned outputs with JSON schema validation
|
|
560
|
+
- **Contracts:** Formal task assignments with auto-resolving dependencies
|
|
561
|
+
- **Peer-to-peer:** ANY session can create contracts for ANY other session (not just the orchestrator)
|
|
562
|
+
|
|
563
|
+
**Layer 3: Reactive Intelligence** — The system monitors itself and auto-heals (like a self-driving car)
|
|
564
|
+
- **Lineage Graph:** Track data provenance, detect stale artifacts, analyze impact radius
|
|
565
|
+
- **Reactive Pipelines:** Event-driven trigger→action rules (e.g., "when tests fail, reopen the API contract")
|
|
566
|
+
- **Snapshot & Replay:** Capture full state, rollback, replay workflows with different parameters
|
|
567
|
+
|
|
568
|
+
### Quick Start
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
# Spawn 3 team members
|
|
572
|
+
cms team-spawn --name db-dev --role database --prompt "Create User model"
|
|
573
|
+
cms team-spawn --name api-dev --role backend --prompt "Build auth API"
|
|
574
|
+
cms team-spawn --name qa-dev --role QA --prompt "Write auth tests"
|
|
575
|
+
|
|
576
|
+
# Create a contract chain (Layer 2)
|
|
577
|
+
cms contract-create setup-user-model --assignee db-dev \
|
|
578
|
+
--title "Create User schema" \
|
|
579
|
+
--expected-output schema-change
|
|
580
|
+
|
|
581
|
+
cms contract-create build-auth-api --assignee api-dev \
|
|
582
|
+
--title "Build auth endpoints" \
|
|
583
|
+
--depends-on setup-user-model \
|
|
584
|
+
--expected-output api-contract
|
|
585
|
+
|
|
586
|
+
cms contract-create write-auth-tests --assignee qa-dev \
|
|
587
|
+
--title "Write integration tests" \
|
|
588
|
+
--depends-on build-auth-api \
|
|
589
|
+
--expected-output test-results
|
|
590
|
+
|
|
591
|
+
# Watch the contracts auto-resolve as artifacts are published
|
|
592
|
+
cms contract-list
|
|
593
|
+
|
|
594
|
+
# DB session publishes schema
|
|
595
|
+
cms artifact-publish schema-user-model --type schema-change \
|
|
596
|
+
--name "User model schema" \
|
|
597
|
+
--data '{"models":[{"name":"User","fields":["email","phone","password"]}]}'
|
|
598
|
+
# → setup-user-model auto-completes → build-auth-api becomes "ready"
|
|
599
|
+
|
|
600
|
+
# API session publishes contract (derived from schema)
|
|
601
|
+
cms artifact-publish api-contract-user-auth --type api-contract \
|
|
602
|
+
--name "Auth API contract" \
|
|
603
|
+
--derived-from schema-user-model@v1 \
|
|
604
|
+
--data '{"endpoints":[{"method":"POST","path":"/login"}]}'
|
|
605
|
+
# → build-auth-api auto-completes → write-auth-tests becomes "ready"
|
|
606
|
+
|
|
607
|
+
# QA session publishes test results (derived from API contract)
|
|
608
|
+
cms artifact-publish test-results-auth --type test-results \
|
|
609
|
+
--name "Auth integration tests" \
|
|
610
|
+
--derived-from api-contract-user-auth@v1 \
|
|
611
|
+
--data '{"total":12,"passed":12,"failed":0}'
|
|
612
|
+
# → write-auth-tests auto-completes → entire chain done
|
|
613
|
+
|
|
614
|
+
# Query the lineage graph (Layer 3)
|
|
615
|
+
cms artifact-lineage test-results-auth --direction upstream
|
|
616
|
+
# Shows: test-results → api-contract → schema
|
|
617
|
+
|
|
618
|
+
# Take a snapshot before trying a different approach
|
|
619
|
+
cms team-snapshot pre-graphql --label "Auth feature complete with REST"
|
|
620
|
+
|
|
621
|
+
# Replay with overrides to try GraphQL instead
|
|
622
|
+
cms team-replay pre-graphql --overrides '{"build-auth-api":{"inputs":{"context":"Use GraphQL instead of REST"}}}'
|
|
623
|
+
# → Entire workflow re-executes with GraphQL approach
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
## Layer 1: Chat (8 MCP Tools)
|
|
629
|
+
|
|
630
|
+
Sessions can communicate directly without routing through the orchestrator.
|
|
631
|
+
|
|
632
|
+
| Tool | Description |
|
|
633
|
+
|------|-------------|
|
|
634
|
+
| `team_spawn` | Spawn a session with team system prompt injected (includes roster, artifact/contract tools) |
|
|
635
|
+
| `team_send_message` | Send a DM to a specific teammate |
|
|
636
|
+
| `team_broadcast` | Send a message to all team members |
|
|
637
|
+
| `team_check_inbox` | Check unread messages (do this before starting work and after major steps) |
|
|
638
|
+
| `team_ask` | Ask a question and WAIT for reply (blocking poll) |
|
|
639
|
+
| `team_reply` | Reply to a question received in inbox |
|
|
640
|
+
| `team_roster` | View all team members with roles, status, and lastSeen times |
|
|
641
|
+
| `team_update_status` | Update your own status, task, or role |
|
|
642
|
+
|
|
643
|
+
**Safety features:**
|
|
644
|
+
- Rate limit: 10 messages/minute per session
|
|
645
|
+
- Loop detection: >5 exchanges between same pair in 60s = blocked
|
|
646
|
+
- Auto-compaction: Inbox files auto-compact when they exceed 1000 lines
|
|
647
|
+
|
|
648
|
+
**When to use chat vs artifacts:**
|
|
649
|
+
- Use **chat** for quick questions, coordination, status updates
|
|
650
|
+
- Use **artifacts** for actual work outputs (schemas, API contracts, test results)
|
|
651
|
+
- Use **contracts** to assign work and track progress
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
## Layer 2: Artifacts & Contracts (12 MCP Tools)
|
|
656
|
+
|
|
657
|
+
### Versioned Artifacts (6 Tools)
|
|
658
|
+
|
|
659
|
+
Artifacts are **immutable, versioned outputs** with JSON schema validation for well-known types.
|
|
660
|
+
|
|
661
|
+
| Tool | Description |
|
|
662
|
+
|------|-------------|
|
|
663
|
+
| `artifact_publish` | Publish structured data (creates new version, validates schema, records lineage, triggers resolution + pipelines) |
|
|
664
|
+
| `artifact_get` | Read an artifact (latest or specific version) |
|
|
665
|
+
| `artifact_list` | List all artifacts with optional filters (type, publisher, tag) |
|
|
666
|
+
| `artifact_history` | View all versions of an artifact |
|
|
667
|
+
|
|
668
|
+
**Well-known artifact types** (validated against JSON schemas):
|
|
669
|
+
|
|
670
|
+
| Type | Data Shape |
|
|
671
|
+
|------|-----------|
|
|
672
|
+
| `api-contract` | `{ endpoints: [{ method, path, request, response }] }` |
|
|
673
|
+
| `schema-change` | `{ models: [{ name, action, fields }] }` |
|
|
674
|
+
| `component-spec` | `{ componentName, props, states, events }` |
|
|
675
|
+
| `test-results` | `{ total, passed, failed, failures: [...] }` |
|
|
676
|
+
| `file-manifest` | `{ files: [{ path, action, description }] }` |
|
|
677
|
+
| `config-change` | `{ changes: [{ key, oldValue, newValue }] }` |
|
|
678
|
+
| `custom` | Any JSON (no schema validation) |
|
|
679
|
+
|
|
680
|
+
**Immutability:** Version files are write-once. First writer wins, second gets an error. This prevents version conflicts.
|
|
681
|
+
|
|
682
|
+
**Schema validation:** When publishing a well-known artifact type, the `data` field is validated against the JSON schema. If validation fails, the publish is rejected with a clear error message.
|
|
683
|
+
|
|
684
|
+
### Contracts (6 Tools)
|
|
685
|
+
|
|
686
|
+
Contracts are **formal task assignments** with auto-resolving dependencies. ANY session can create contracts for ANY other session (not just the orchestrator) — this is what makes the system truly **peer-to-peer**.
|
|
687
|
+
|
|
688
|
+
| Tool | Description |
|
|
689
|
+
|------|-------------|
|
|
690
|
+
| `contract_create` | Create a task contract and assign it to any teammate (peer-to-peer) |
|
|
691
|
+
| `contract_start` | Start working on an assigned contract (returns inputs + resolved artifacts) |
|
|
692
|
+
| `contract_complete` | Mark a contract as done (triggers cascade + pipelines) |
|
|
693
|
+
| `contract_fail` | Mark a contract as failed (notifies assigner) |
|
|
694
|
+
| `contract_reopen` | Reopen a failed/completed contract for retry (increments retryCount) |
|
|
695
|
+
| `contract_get` | Get full contract details |
|
|
696
|
+
| `contract_list` | List all contracts with optional filters (status, assignee, assigner) |
|
|
697
|
+
| `contract_reassign` | Change who's assigned to a contract |
|
|
698
|
+
|
|
699
|
+
**Contract lifecycle:**
|
|
700
|
+
|
|
701
|
+
```
|
|
702
|
+
pending → ready → in_progress → completed
|
|
703
|
+
↑ ↓
|
|
704
|
+
└─ (reopen) ─ failed
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
- **pending:** Waiting for dependencies (other contracts or artifacts)
|
|
708
|
+
- **ready:** All dependencies satisfied, ready to start
|
|
709
|
+
- **in_progress:** Assignee is working on it
|
|
710
|
+
- **completed:** Auto-completed when acceptance criteria are met
|
|
711
|
+
- **failed:** Assignee marked it as failed OR timeout exceeded
|
|
712
|
+
|
|
713
|
+
**Acceptance criteria types:**
|
|
714
|
+
|
|
715
|
+
| Type | Met when |
|
|
716
|
+
|------|----------|
|
|
717
|
+
| `artifact_published` | Matching artifact exists at required version |
|
|
718
|
+
| `tests_passing` | test-results artifact meets pass/fail thresholds |
|
|
719
|
+
| `contract_completed` | Referenced contract is completed |
|
|
720
|
+
| `all_outputs_published` | All required expectedOutputs have matching artifacts |
|
|
721
|
+
|
|
722
|
+
**Safety features:**
|
|
723
|
+
- **Timeout:** Contracts can have `timeoutMs` — auto-failed if not completed in time
|
|
724
|
+
- **Retry limit:** `maxRetries` (default 3) — reopen rejected after too many failures
|
|
725
|
+
- **Circular dependency detection:** DFS cycle detection on contract creation
|
|
726
|
+
- **Cascade depth guard:** Max 10 levels of auto-resolution to prevent infinite loops
|
|
727
|
+
|
|
728
|
+
---
|
|
729
|
+
|
|
730
|
+
## Layer 3: Reactive Intelligence (12 MCP Tools)
|
|
731
|
+
|
|
732
|
+
This is the layer that makes the system **unbeatable**. Each feature depends on Layer 2's versioned artifacts and contract state machine — competitors cannot bolt these on because they lack the foundation.
|
|
733
|
+
|
|
734
|
+
### 3a. Lineage Graph (4 Tools)
|
|
735
|
+
|
|
736
|
+
Track **data provenance** and analyze impact.
|
|
737
|
+
|
|
738
|
+
| Tool | Description |
|
|
739
|
+
|------|-------------|
|
|
740
|
+
| `artifact_lineage` | Query the provenance DAG (upstream: what inputs? downstream: what depends on this?) |
|
|
741
|
+
| `artifact_impact` | "If I change this artifact, what downstream artifacts and contracts break?" |
|
|
742
|
+
| `artifact_stale` | List all artifacts derived from outdated sources (e.g., derived from v1 but v2 now exists) |
|
|
743
|
+
| `team_audit` | Full provenance trail: who created it, from what inputs, under which contract, at what time |
|
|
744
|
+
|
|
745
|
+
**How lineage is captured:**
|
|
746
|
+
|
|
747
|
+
Every `artifact_publish` can include a `derivedFrom` array listing input artifacts. Additionally, when a contract completes, the system auto-links published artifacts to the contract's input artifacts. This builds a full DAG (directed acyclic graph) of how data flowed through the system.
|
|
748
|
+
|
|
749
|
+
**Example:**
|
|
750
|
+
|
|
751
|
+
```
|
|
752
|
+
schema-user-model@v1 (root)
|
|
753
|
+
└─► api-contract-user-auth@v2 (derivedFrom schema@v1)
|
|
754
|
+
└─► test-results-auth@v1 (derivedFrom api-contract@v2)
|
|
755
|
+
|
|
756
|
+
If schema-user-model gets bumped to v2:
|
|
757
|
+
→ artifact_stale() reports api-contract-user-auth@v2 as stale
|
|
758
|
+
→ artifact_impact("schema-user-model") shows 2 downstream artifacts affected
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
### 3b. Reactive Pipelines (4 Tools)
|
|
762
|
+
|
|
763
|
+
Event-driven **trigger→condition→action** rules. "When X happens, automatically do Y."
|
|
764
|
+
|
|
765
|
+
| Tool | Description |
|
|
766
|
+
|------|-------------|
|
|
767
|
+
| `pipeline_create` | Define trigger→condition→action rules |
|
|
768
|
+
| `pipeline_list` | View active pipelines and execution counts |
|
|
769
|
+
| `pipeline_pause` | Disable a pipeline without deleting |
|
|
770
|
+
| `pipeline_resume` | Re-enable a paused pipeline |
|
|
771
|
+
|
|
772
|
+
**Trigger types:**
|
|
773
|
+
|
|
774
|
+
| Trigger | Fires when |
|
|
775
|
+
|---------|-----------|
|
|
776
|
+
| `artifact_published` | Any artifact of matching type/id is published |
|
|
777
|
+
| `artifact_version_bumped` | An existing artifact gets a new version |
|
|
778
|
+
| `contract_completed` | A contract transitions to completed |
|
|
779
|
+
| `contract_failed` | A contract transitions to failed |
|
|
780
|
+
| `artifact_stale` | An artifact is detected as stale |
|
|
781
|
+
|
|
782
|
+
**Action types:**
|
|
783
|
+
|
|
784
|
+
| Action | What it does |
|
|
785
|
+
|--------|-------------|
|
|
786
|
+
| `notify_session` | Send an inbox message to a specific session |
|
|
787
|
+
| `broadcast` | Send inbox message to all team members |
|
|
788
|
+
| `reopen_contract` | Call contract_reopen with given reason |
|
|
789
|
+
| `create_contract` | Create a new contract (deduplication: skips if already exists) |
|
|
790
|
+
| `invalidate_downstream` | Mark all downstream artifacts as stale via lineage graph |
|
|
791
|
+
|
|
792
|
+
**Example pipeline (self-healing CI loop):**
|
|
793
|
+
|
|
794
|
+
```javascript
|
|
795
|
+
{
|
|
796
|
+
rules: [
|
|
797
|
+
{
|
|
798
|
+
trigger: { type: "artifact_published", artifactType: "api-contract" },
|
|
799
|
+
action: { type: "notify_session", target: "qa-dev",
|
|
800
|
+
message: "API contract updated — re-run tests" }
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
trigger: { type: "artifact_published", artifactType: "test-results" },
|
|
804
|
+
condition: "data.failed > 0",
|
|
805
|
+
action: { type: "reopen_contract", contractId: "build-auth-api",
|
|
806
|
+
reason: "Tests failing: ${data.failed} failures" }
|
|
807
|
+
}
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
When tests fail, the API contract is **automatically reopened** without human intervention. When the API is fixed and tests pass, the contract auto-completes. This is a **self-healing CI loop** with zero conversation.
|
|
813
|
+
|
|
814
|
+
### 3c. Snapshot & Replay (4 Tools)
|
|
815
|
+
|
|
816
|
+
**Time-travel** for workflows. Capture full state, rollback, replay with different parameters.
|
|
817
|
+
|
|
818
|
+
| Tool | Description |
|
|
819
|
+
|------|-------------|
|
|
820
|
+
| `team_snapshot` | Capture current state of all contracts + artifacts + pipelines |
|
|
821
|
+
| `team_snapshot_list` | View all snapshots with timestamp and summary |
|
|
822
|
+
| `team_rollback` | Reset contract/pipeline state to a previous snapshot |
|
|
823
|
+
| `team_replay` | Rollback + apply overrides + re-trigger dependency resolution |
|
|
824
|
+
|
|
825
|
+
**Why this matters:**
|
|
826
|
+
|
|
827
|
+
Because artifacts are **immutable** (version files never change) and contracts have a well-defined **state machine**, the entire system state can be captured as a snapshot and restored later.
|
|
828
|
+
|
|
829
|
+
**Rollback:** Undo a bad workflow execution and restore to a known-good state.
|
|
830
|
+
|
|
831
|
+
**Replay:** Re-execute from a snapshot with different parameters (e.g., "try GraphQL instead of REST"). The entire downstream chain re-executes with the new approach. Original artifacts are preserved as historical versions for comparison.
|
|
832
|
+
|
|
833
|
+
**Example:**
|
|
834
|
+
|
|
835
|
+
```bash
|
|
836
|
+
# Take a snapshot before a risky operation
|
|
837
|
+
cms team-snapshot pre-refactor --label "Before auth refactor"
|
|
838
|
+
|
|
839
|
+
# Do the refactor... oops, tests are broken
|
|
840
|
+
cms contract-list # shows multiple failed contracts
|
|
841
|
+
|
|
842
|
+
# Rollback to the snapshot
|
|
843
|
+
cms team-rollback pre-refactor
|
|
844
|
+
# → Contracts reset to their pre-refactor state
|
|
845
|
+
# → Post-snapshot artifacts marked as "rolled-back" (files preserved)
|
|
846
|
+
# → Sessions notified to restart
|
|
847
|
+
|
|
848
|
+
# Or replay with different parameters
|
|
849
|
+
cms team-replay pre-refactor --overrides '{"build-auth-api":{"inputs":{"context":"Use JWT instead of sessions"}}}'
|
|
850
|
+
# → Entire workflow re-executes with JWT approach
|
|
851
|
+
# → Compare test-results artifacts from both runs
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
---
|
|
855
|
+
|
|
856
|
+
## CLI Commands (Team Hub v2)
|
|
857
|
+
|
|
858
|
+
### Chat Commands
|
|
859
|
+
|
|
860
|
+
```bash
|
|
861
|
+
cms team-send --from db-dev --to api-dev --message "Schema is ready"
|
|
862
|
+
cms team-broadcast --from orchestrator --message "Deploy in 10 minutes"
|
|
863
|
+
cms team-roster # View all team members
|
|
864
|
+
cms team-inbox --name db-dev # Check unread messages
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
### Artifact Commands
|
|
868
|
+
|
|
869
|
+
```bash
|
|
870
|
+
cms artifact-publish schema-user-model --type schema-change \
|
|
871
|
+
--name "User schema" --data '{"models":[...]}'
|
|
872
|
+
|
|
873
|
+
cms artifact-get api-contract-user-auth # Latest version
|
|
874
|
+
cms artifact-get api-contract-user-auth --version 2 # Specific version
|
|
875
|
+
cms artifact-list --type api-contract
|
|
876
|
+
cms artifact-history api-contract-user-auth
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
### Contract Commands
|
|
880
|
+
|
|
881
|
+
```bash
|
|
882
|
+
cms contract-create setup-user-model --assignee db-dev \
|
|
883
|
+
--title "Create User schema" \
|
|
884
|
+
--expected-output schema-change
|
|
885
|
+
|
|
886
|
+
cms contract-start setup-user-model
|
|
887
|
+
cms contract-complete setup-user-model --summary "User model created"
|
|
888
|
+
cms contract-fail setup-user-model --reason "Missing field validation"
|
|
889
|
+
cms contract-reopen setup-user-model --reason "Add phone field"
|
|
890
|
+
cms contract-list --status ready
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
### Lineage Commands
|
|
894
|
+
|
|
895
|
+
```bash
|
|
896
|
+
cms artifact-lineage test-results-auth --direction upstream
|
|
897
|
+
cms artifact-lineage schema-user-model --direction downstream
|
|
898
|
+
cms artifact-impact schema-user-model # What breaks if I change this?
|
|
899
|
+
cms artifact-stale # List all artifacts derived from outdated sources
|
|
900
|
+
cms team-audit test-results-auth # Full provenance trail
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
### Pipeline Commands
|
|
904
|
+
|
|
905
|
+
```bash
|
|
906
|
+
cms pipeline-create ci-loop --rules ci-rules.json
|
|
907
|
+
cms pipeline-list
|
|
908
|
+
cms pipeline-pause ci-loop
|
|
909
|
+
cms pipeline-resume ci-loop
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
### Snapshot Commands
|
|
913
|
+
|
|
914
|
+
```bash
|
|
915
|
+
cms team-snapshot pre-work --label "All contracts created"
|
|
916
|
+
cms team-snapshot-list
|
|
917
|
+
cms team-rollback pre-work
|
|
918
|
+
cms team-replay pre-work --overrides overrides.json
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
---
|
|
922
|
+
|
|
923
|
+
## Architecture & Directory Structure
|
|
924
|
+
|
|
925
|
+
```
|
|
926
|
+
~/.claude-multi-session/
|
|
927
|
+
sessions.json # Existing session metadata (unchanged)
|
|
928
|
+
team/
|
|
929
|
+
default/ # Team namespace
|
|
930
|
+
roster.json # Layer 1: who's active, role, status
|
|
931
|
+
inbox/
|
|
932
|
+
{session}.jsonl # Layer 1: chat messages (append-only)
|
|
933
|
+
asks/
|
|
934
|
+
ask_{id}.json # Layer 1: pending ask-and-wait
|
|
935
|
+
artifacts/
|
|
936
|
+
index.json # Layer 2: artifact registry
|
|
937
|
+
schemas/ # Layer 2: JSON schemas for well-known types
|
|
938
|
+
api-contract.json
|
|
939
|
+
schema-change.json
|
|
940
|
+
test-results.json
|
|
941
|
+
data/
|
|
942
|
+
{artifactId}/
|
|
943
|
+
v1.json # Immutable version files
|
|
944
|
+
v2.json
|
|
945
|
+
contracts/
|
|
946
|
+
index.json # Layer 2: contract state
|
|
947
|
+
pipelines/
|
|
948
|
+
index.json # Layer 3: reactive pipeline rules
|
|
949
|
+
log.jsonl # Layer 3: pipeline execution history
|
|
950
|
+
snapshots/
|
|
951
|
+
snap_{id}.json # Layer 3: full state snapshots
|
|
952
|
+
locks/
|
|
953
|
+
artifacts-index.lock # Cross-process lock files
|
|
954
|
+
contracts-index.lock
|
|
955
|
+
pipelines-index.lock
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
**Key design choices:**
|
|
959
|
+
|
|
960
|
+
- **JSONL for inboxes:** Append-only, safe for concurrent writers
|
|
961
|
+
- **JSON for indexes:** Atomic temp+rename for safe updates
|
|
962
|
+
- **Immutable version files:** Write-once (wx flag), first writer wins
|
|
963
|
+
- **File locks:** PID-aware locking with staleness detection
|
|
964
|
+
- **Team namespaces:** Multiple teams can coexist in separate directories
|
|
965
|
+
|
|
966
|
+
---
|
|
967
|
+
|
|
968
|
+
## Comparison: Why This Is Revolutionary
|
|
969
|
+
|
|
970
|
+
| | Agent Teams | claude-flow | CrewAI | **claude-multi-session v2.0** |
|
|
971
|
+
|---|---|---|---|---|
|
|
972
|
+
| Coordination model | Conversational | Conversational | Conversational | **Transactional** |
|
|
973
|
+
| Structured data exchange | No | No | No | **Versioned artifacts** |
|
|
974
|
+
| Schema validation | No | No | No | **JSON schema on publish** |
|
|
975
|
+
| Auto-resolving dependencies | No | No | No | **Contract system** |
|
|
976
|
+
| Peer-to-peer task assignment | No | No | No | **Any session → any session** |
|
|
977
|
+
| Contract timeout + retry | No | No | No | **Yes** |
|
|
978
|
+
| Direct session messaging | Yes (text only) | No | No | **Yes (text + structured artifacts)** |
|
|
979
|
+
| Data lineage / provenance | No | No | No | **Full DAG** |
|
|
980
|
+
| Impact analysis | No | No | No | **"What breaks if I change X?"** |
|
|
981
|
+
| Reactive pipelines | No | No | No | **Event-driven trigger→action** |
|
|
982
|
+
| Self-healing CI loops | No | No | No | **Auto-reopen + re-test** |
|
|
983
|
+
| Workflow snapshots | No | No | No | **Full state capture** |
|
|
984
|
+
| Rollback + replay | No | No | No | **Time-travel with overrides** |
|
|
985
|
+
| Each session: own context | No (shared) | No | No | **100K each** |
|
|
986
|
+
| Resume team next day | No | No | No | **Yes** |
|
|
987
|
+
| Quality over time | Degrades | Degrades | Degrades | **Stays consistent** |
|
|
988
|
+
| Zero dependencies | N/A | No (46MB) | No | **Yes** |
|
|
989
|
+
|
|
990
|
+
**The key insight:** Every competitor uses conversational coordination — agents talk in natural language, summaries pile up, quality degrades over time. We use **transactional coordination** — agents exchange structured data, operate on formal contracts, and auto-resolve dependencies. The result is a system that **stays consistent** instead of degrading.
|
|
991
|
+
|
|
992
|
+
**The moat:** Layer 3 features (lineage, pipelines, snapshots) cannot be bolted onto conversational systems because they require Layer 2 (versioned artifacts + contracts) to exist first. Competitors would need to rebuild their entire coordination layer to replicate this.
|
|
993
|
+
|
|
994
|
+
---
|
|
995
|
+
|
|
543
996
|
## License
|
|
544
997
|
|
|
545
998
|
MIT
|