@prmichaelsen/firebase-admin-sdk-v8 2.8.0 → 2.9.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/AGENT.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Context Protocol (ACP)
2
2
 
3
3
  **Also Known As**: The Agent Directory Pattern
4
- **Version**: 3.13.0
4
+ **Version**: 5.22.0
5
5
  **Created**: 2026-02-11
6
6
  **Status**: Production Pattern
7
7
 
@@ -17,9 +17,17 @@
17
17
  6. [How to Use the Agent Pattern](#how-to-use-the-agent-pattern)
18
18
  7. [Pattern Significance & Impact](#pattern-significance--impact)
19
19
  8. [Problems This Pattern Solves](#problems-this-pattern-solves)
20
- 9. [Instructions for Future Agents](#instructions-for-future-agents)
21
- 10. [Real-World Example: remember-mcp](#real-world-example-remember-mcp)
20
+ 9. [Key File Index](#key-file-index)
21
+ 10. [Instructions for Future Agents](#instructions-for-future-agents)
22
22
  11. [Best Practices](#best-practices)
23
+ - [Critical Rules](#critical-rules)
24
+ - [Workflow Best Practices](#workflow-best-practices)
25
+ - [Documentation Best Practices](#documentation-best-practices)
26
+ - [Organization Best Practices](#organization-best-practices)
27
+ - [Progress Tracking Best Practices](#progress-tracking-best-practices)
28
+ - [Quality Best Practices](#quality-best-practices)
29
+ 12. [What NOT to Do](#what-not-to-do)
30
+ 13. [Keeping ACP Updated](#keeping-acp-updated)
23
31
 
24
32
  ---
25
33
 
@@ -110,9 +118,22 @@ project-root/
110
118
  │ │
111
119
  │ ├── tasks/ # Granular tasks
112
120
  │ │ ├── .gitkeep
113
- │ │ ├── task-1-{name}.md
114
- │ │ ├── task-2-{name}.md
115
- │ │ └── ...
121
+ │ │ ├── milestone-{N}-{title}/ # Tasks grouped by milestone (standard)
122
+ │ │ ├── task-{M}-{name}.md
123
+ │ │ └── ...
124
+ │ │ ├── unassigned/ # Tasks without milestone
125
+ │ │ │ └── task-{M}-{name}.md
126
+ │ │ └── task-{N}-{name}.md # Legacy flat structure (older tasks)
127
+ │ │
128
+ │ ├── files/ # Template source files (in packages)
129
+ │ │ ├── config/ # Config templates
130
+ │ │ └── src/ # Source code templates
131
+ │ │
132
+ │ ├── index/ # Key file index
133
+ │ │ ├── .gitkeep
134
+ │ │ ├── local.main.yaml # Project's own key files
135
+ │ │ ├── local.main.template.yaml# Template with schema docs
136
+ │ │ └── {pkg}.main.yaml # Package-shipped indices
116
137
  │ │
117
138
  │ └── progress.yaml # Progress tracking
118
139
 
@@ -279,6 +300,7 @@ project:
279
300
  milestones:
280
301
  - id: M1
281
302
  name: Milestone Name
303
+ file: agent/milestones/milestone-1-name.md
282
304
  status: not_started | in_progress | completed
283
305
  progress: 0-100%
284
306
  started: YYYY-MM-DD
@@ -294,13 +316,19 @@ tasks:
294
316
  - id: task-1
295
317
  name: Task Name
296
318
  status: not_started | in_progress | completed
297
- file: agent/tasks/task-1-name.md
319
+ started: ISO-8601 | null
320
+ file: agent/tasks/milestone-{N}-{title}/task-{M}-name.md
298
321
  estimated_hours: N
299
- actual_hours: null
300
- completed_date: YYYY-MM-DD | null
322
+ actual_hours: null # auto-computed
323
+ completed_date: ISO-8601 | null
301
324
  notes: |
302
325
  Task notes
303
326
 
327
+ **Timestamp Rules**:
328
+ - `started` — auto-set to ISO 8601 timestamp when task first transitions to `in_progress`. Never overwritten once set.
329
+ - `completed_date` — auto-set to ISO 8601 timestamp when task transitions to `completed`.
330
+ - `actual_hours` — auto-computed as `(completed_date - started)` in hours, rounded to 1 decimal. Not manually set.
331
+
304
332
  documentation:
305
333
  design_documents: N
306
334
  milestone_documents: N
@@ -345,10 +373,9 @@ current_blockers:
345
373
  touch agent/{design,milestones,patterns,tasks}/.gitkeep
346
374
  ```
347
375
 
348
- 2. **Write Requirements Document**
349
- - Create `agent/design/requirements.md`
350
- - Document core requirements, constraints, and goals
351
- - Define success criteria
376
+ 2. **Create Requirements Document**
377
+ - Invoke [`@acp.design-create`](agent/commands/acp.design-create.md) and follow directives defined in that file
378
+ - Specify "requirements" as the design type
352
379
 
353
380
  3. **Define Milestones**
354
381
  - Break project into 5-10 major phases
@@ -356,9 +383,8 @@ current_blockers:
356
383
  - Clear deliverables and success criteria
357
384
 
358
385
  4. **Create Initial Tasks**
386
+ - Invoke [`@acp.task-create`](agent/commands/acp.task-create.md) and follow directives defined in that file
359
387
  - Break first milestone into concrete tasks
360
- - Each task should be 1-4 hours of work
361
- - Include verification steps
362
388
 
363
389
  5. **Initialize Progress Tracking**
364
390
  - Create `agent/progress.yaml`
@@ -366,9 +392,8 @@ current_blockers:
366
392
  - Document initial status
367
393
 
368
394
  6. **Document Patterns**
369
- - Create `agent/patterns/bootstrap.md` with setup instructions
395
+ - Invoke [`@acp.pattern-create`](agent/commands/acp.pattern-create.md) and follow directives defined in that file
370
396
  - Document architectural decisions as patterns
371
- - Include code examples
372
397
 
373
398
  ### For Continuing an Existing Project
374
399
 
@@ -402,25 +427,7 @@ current_blockers:
402
427
  - Add notes about work completed
403
428
  - Document any new patterns or decisions
404
429
 
405
- ### For Adding New Features
406
-
407
- 1. **Create Design Document**
408
- - Document in `agent/design/{feature}-design.md`
409
- - Include problem, solution, implementation
410
- - Get approval before proceeding
411
-
412
- 2. **Update Milestones**
413
- - Add new milestone or extend existing
414
- - Update progress.yaml
415
-
416
- 3. **Create Tasks**
417
- - Break feature into tasks
418
- - Add to appropriate milestone
419
- - Include verification steps
420
-
421
- 4. **Document Patterns**
422
- - If feature introduces new patterns, document them
423
- - Update existing patterns if needed
430
+ > **See also**: [Best Practices](#best-practices) for detailed guidance on documentation, organization, and quality standards.
424
431
 
425
432
  ---
426
433
 
@@ -601,41 +608,9 @@ Commands are invoked using the `@` syntax with dot notation:
601
608
 
602
609
  ### Creating Custom Commands
603
610
 
604
- To create custom commands for your project:
605
-
606
- 1. **Choose a namespace** (e.g., `deploy`, `test`, `custom`)
607
- - ⚠️ The `acp` namespace is reserved for core commands
608
- - Use descriptive, single-word namespaces
609
-
610
- 2. **Copy the command template**:
611
- ```bash
612
- cp agent/commands/command.template.md agent/commands/{namespace}.{action}.md
613
- ```
611
+ Invoke [`@acp.command-create`](agent/commands/acp.command-create.md) and follow directives defined in that file.
614
612
 
615
- 3. **Fill in the template sections**:
616
- - Purpose and description
617
- - Prerequisites
618
- - Step-by-step instructions
619
- - Verification checklist
620
- - Examples and troubleshooting
621
-
622
- 4. **Invoke your command**: `@{namespace}.{action}`
623
-
624
- **Example**: Creating a deployment command:
625
- ```bash
626
- # Create the command file
627
- cp agent/commands/command.template.md agent/commands/deploy.production.md
628
-
629
- # Edit the file with your deployment steps
630
- # ...
631
-
632
- # Invoke it
633
- @deploy.production
634
- ```
635
-
636
- ### Command Template
637
-
638
- See [`agent/commands/command.template.md`](agent/commands/command.template.md) for the complete command template with all sections and examples.
613
+ **Note**: The `acp` namespace is reserved for core commands. Use descriptive, single-word namespaces for custom commands (e.g., `local`, `deploy`, `test`, `custom`).
639
614
 
640
615
  ### Installing Third-Party Commands
641
616
 
@@ -720,6 +695,123 @@ When working in any project, you can discover globally installed packages:
720
695
 
721
696
  ---
722
697
 
698
+ ## Project Registry System
699
+
700
+ ACP supports a global project registry at `~/.acp/projects.yaml` that tracks all projects in the `~/.acp/projects/` workspace. This enables project discovery, context switching, and metadata management across your entire ACP workspace.
701
+
702
+ ### Key Features
703
+
704
+ - **Project Discovery**: List all registered projects with filtering options
705
+ - **Context Switching**: Quickly switch between projects using `@acp.project-set`
706
+ - **Metadata Tracking**: Track project type, status, tags, and relationships
707
+ - **Automatic Registration**: Projects auto-register when created via `@acp.project-create`
708
+ - **Sync Discovery**: Find and register existing projects with `@acp.projects-sync`
709
+
710
+ ### Commands
711
+
712
+ | Command | Description |
713
+ |---------|-------------|
714
+ | [`@acp.project-list`](agent/commands/acp.project-list.md) | List all registered projects with optional filtering |
715
+ | [`@acp.project-set`](agent/commands/acp.project-set.md) | Switch to a project (set as current) |
716
+ | [`@acp.project-info`](agent/commands/acp.project-info.md) | Show detailed project information |
717
+ | [`@acp.project-update`](agent/commands/acp.project-update.md) | Update project metadata |
718
+ | [`@acp.project-remove`](agent/commands/acp.project-remove.md) | Remove project from registry |
719
+ | [`@acp.projects-sync`](agent/commands/acp.projects-sync.md) | Discover and register existing projects |
720
+
721
+ ### Registry Structure
722
+
723
+ The `~/.acp/projects.yaml` file tracks all registered projects:
724
+
725
+ ```yaml
726
+ projects:
727
+ - name: my-project
728
+ path: /home/user/.acp/projects/my-project
729
+ type: library
730
+ status: in_progress
731
+ registered: 2026-02-23T10:00:00Z
732
+ last_accessed: 2026-02-26T15:30:00Z
733
+ tags:
734
+ - typescript
735
+ - npm
736
+ related_projects: []
737
+ description: My awesome project
738
+
739
+ current_project: my-project
740
+ ```
741
+
742
+ ### Example Workflow
743
+
744
+ ```bash
745
+ # List all projects
746
+ @acp.project-list
747
+
748
+ # Switch to a specific project
749
+ @acp.project-set my-project
750
+
751
+ # View project details
752
+ @acp.project-info
753
+
754
+ # Update project metadata
755
+ @acp.project-update --tags "typescript,api,rest"
756
+
757
+ # Discover unregistered projects
758
+ @acp.projects-sync
759
+
760
+ # Remove a project from registry (keeps files)
761
+ @acp.project-remove old-project
762
+ ```
763
+
764
+ ### For Agents: How to Use the Registry
765
+
766
+ When working in any ACP project, you can:
767
+
768
+ 1. **Check current project**: Read `~/.acp/projects.yaml` and find `current_project`
769
+ 2. **List available projects**: Use `@acp.project-list` to see all projects
770
+ 3. **Switch context**: Use `@acp.project-set <name>` to change projects
771
+ 4. **Get project info**: Use `@acp.project-info` for detailed metadata
772
+
773
+ **Automatic Tracking**: The `@acp.init` command automatically reads the registry and reports the current project context.
774
+
775
+ ---
776
+
777
+ ## Sessions System
778
+
779
+ ACP supports global session tracking via `~/.acp/sessions.yaml` for awareness of concurrent agent work across projects. When multiple `claude` terminals run from a single IDE instance, sessions give each agent visibility into what other agents are doing.
780
+
781
+ This is an advisory-only visibility layer — no locking or coordination. Sessions are registered at `@acp.init` and deregistered at `@acp.report`, with automatic stale cleanup for crashed terminals.
782
+
783
+ ### What sessions.yaml Tracks
784
+
785
+ Each session entry contains: session ID, project name, description, timestamps (started, last_activity), status (active/idle), current milestone and task, PID (for stale detection), terminal, and optional remote URL.
786
+
787
+ ### Commands
788
+
789
+ | Command | Description |
790
+ |---------|-------------|
791
+ | [`@acp.sessions`](agent/commands/acp.sessions.md) | List, clean, deregister, or count sessions |
792
+ | `@acp.sessions list` | Show all active sessions |
793
+ | `@acp.sessions clean` | Remove stale sessions (dead PIDs, timeouts) |
794
+ | `@acp.sessions deregister` | End current session |
795
+
796
+ ### Integration with Other Commands
797
+
798
+ | Command | Integration |
799
+ |---------|-------------|
800
+ | `@acp.init` | Registers session and displays active siblings |
801
+ | `@acp.status` | Shows session count ("Sessions: N active") |
802
+ | `@acp.report` | Deregisters session on completion |
803
+
804
+ All integrations are optional — if `acp.sessions.sh` is missing, commands skip the session step silently.
805
+
806
+ ### Session Lifecycle
807
+
808
+ 1. **Register**: `@acp.init` registers a session with project, PID, timestamps
809
+ 2. **Heartbeat**: Activity updates via `acp.sessions.sh heartbeat`
810
+ 3. **Deregister**: `@acp.report` ends the session, or manual via `@acp.sessions deregister`
811
+ 4. **Stale Cleanup**: Dead PIDs removed immediately; inactive >2h removed; inactive >30m marked idle
812
+
813
+ ---
814
+
723
815
  ## Experimental Features
724
816
 
725
817
  ACP supports marking features as "experimental" to enable safe innovation without affecting stable installations.
@@ -797,6 +889,196 @@ Validation ensures consistency:
797
889
 
798
890
  ---
799
891
 
892
+ ## Benchmark Suite
893
+
894
+ ACP includes an automated E2E benchmark system that compares project outcomes with and without ACP to generate quantitative success metrics.
895
+
896
+ ### Quick Start
897
+
898
+ ```bash
899
+ # Run all benchmarks (ACP vs baseline)
900
+ bash agent/benchmarks/runner/run-benchmark.sh
901
+
902
+ # Run a specific task
903
+ bash agent/benchmarks/runner/run-benchmark.sh --task complex-auth-system
904
+
905
+ # Run ACP mode only, 3 runs for statistical averaging
906
+ bash agent/benchmarks/runner/run-benchmark.sh --task medium-rest-api --acp-only --runs 3
907
+
908
+ # Serve HTML reports
909
+ bash agent/benchmarks/runner/serve-reports.sh
910
+ ```
911
+
912
+ ### Benchmark Tasks
913
+
914
+ | Task | Complexity | Steps | Description |
915
+ |------|-----------|-------|-------------|
916
+ | hello-world | simple | 1 | Basic script creation |
917
+ | simple-cli-tool | medium | 3 | CSV-to-JSON CLI tool |
918
+ | medium-rest-api | medium | 4 | Express CRUD API with refactoring |
919
+ | complex-auth-system | complex | 5 | JWT authentication system |
920
+ | legacy-refactor | complex | 6 | Refactor messy legacy app (seed-based) |
921
+ | order-pipeline | complex | 7 | Order system with event-driven pivot |
922
+
923
+ ### How It Works
924
+
925
+ 1. Each task runs in an isolated temp directory using `claude -p` (non-interactive mode)
926
+ 2. Multi-turn conversations use `--resume` for step-by-step execution
927
+ 3. ACP mode installs ACP and injects `@acp.plan` / `@acp.proceed` directives
928
+ 4. After execution: automated verification checks + LLM evaluator (6-category rubric)
929
+ 5. Reports generated in Markdown and HTML (with Chart.js radar charts)
930
+
931
+ ### Key Files
932
+
933
+ - `agent/benchmarks/runner/run-benchmark.sh` — Main entry point
934
+ - `agent/benchmarks/runner/run-single.sh` — Single task/mode runner
935
+ - `agent/benchmarks/runner/verify.sh` — Verification functions per task
936
+ - `agent/benchmarks/runner/evaluator-prompt.md` — LLM evaluator rubric
937
+ - `agent/benchmarks/suite/` — Benchmark task definitions
938
+ - `agent/benchmarks/reports/` — Generated reports (gitignored)
939
+ - `.github/workflows/benchmark.yaml` — On-demand CI workflow
940
+
941
+ ### Design Document
942
+
943
+ See [agent/design/local.benchmark-suite.md](agent/design/local.benchmark-suite.md) for the full design specification.
944
+
945
+ ---
946
+
947
+ ## Template Source Files
948
+
949
+ ACP packages can bundle template source files (code, configs, etc.) alongside patterns, commands, and designs. Templates are declared in the `contents.files` section of `package.yaml` and stored in the `agent/files/` directory of the package.
950
+
951
+ ### Templates vs Other Content Types
952
+
953
+ | Type | Location | Purpose |
954
+ |------|----------|---------|
955
+ | Patterns | `agent/patterns/` | Documentation and guidance |
956
+ | Commands | `agent/commands/` | Agent directives |
957
+ | Designs | `agent/design/` | Architecture documentation |
958
+ | Scripts | `agent/scripts/` | Shell utilities |
959
+ | **Files** | **Project root (target paths)** | **Actual code and config files** |
960
+
961
+ ### Installing Template Files
962
+
963
+ ```bash
964
+ # Install all files (templates install to target paths)
965
+ @acp.package-install --repo <url>
966
+
967
+ # Install specific template files only
968
+ @acp.package-install --files config/tsconfig.json src/schemas/example.schema.ts --repo <url>
969
+
970
+ # Preview what would be installed
971
+ @acp.package-install --list --repo <url>
972
+ ```
973
+
974
+ ### Variable Substitution
975
+
976
+ Templates with `.template` extension can contain `{{VARIABLE}}` placeholders that are replaced during installation:
977
+
978
+ ```json
979
+ {
980
+ "name": "{{PACKAGE_NAME}}",
981
+ "author": "{{AUTHOR_NAME}}"
982
+ }
983
+ ```
984
+
985
+ Variables are declared in `package.yaml` and values are prompted during installation. Variable values are stored in the manifest for reproducible updates.
986
+
987
+ ### Target Paths
988
+
989
+ Each file declares a `target` path in `package.yaml`:
990
+ - `target: ./` installs to project root
991
+ - `target: src/schemas/` installs to `src/schemas/` directory
992
+ - `.template` extension is stripped (e.g., `settings.json.template` becomes `settings.json`)
993
+ - Unsafe paths (`../`, absolute paths) are rejected
994
+
995
+ ### Security Considerations
996
+
997
+ Templates install to project directories (not `agent/`):
998
+ - May overwrite existing files
999
+ - Always prompted before installation (unless `-y` flag)
1000
+ - Target paths validated for safety
1001
+ - Conflict detection warns about overwrites
1002
+ - Use `--list` to preview before installing
1003
+
1004
+ ### Package.yaml Declaration
1005
+
1006
+ ```yaml
1007
+ contents:
1008
+ files:
1009
+ - name: config/tsconfig.json
1010
+ description: TypeScript configuration
1011
+ target: ./
1012
+ required: true
1013
+
1014
+ - name: config/settings.json.template
1015
+ description: Settings with variable substitution
1016
+ target: config/
1017
+ required: false
1018
+ variables:
1019
+ - PROJECT_NAME
1020
+ - AUTHOR_NAME
1021
+ ```
1022
+
1023
+ ---
1024
+
1025
+ ## Key File Index
1026
+
1027
+ This project uses the ACP Key File Index system to ensure agents read critical files before making decisions. Key files are declared in `agent/index/` with weights and descriptions.
1028
+
1029
+ ### How It Works
1030
+
1031
+ Index files in `agent/index/` declare which project files are critical. Each entry includes:
1032
+ - **path**: Path to the file (relative to project root)
1033
+ - **weight**: Priority from 0.0-1.0 (higher = more important)
1034
+ - **kind**: Type of file — `pattern`, `command`, `design`, or `requirements`
1035
+ - **description**: What the file contains
1036
+ - **rationale**: Why an agent must read it
1037
+ - **applies**: Comma-separated list of commands that should read this file (e.g. `acp.proceed, acp.plan`)
1038
+
1039
+ ### Index File Naming
1040
+
1041
+ Files follow `{namespace}.{qualifier}.yaml` naming:
1042
+ - `local.main.yaml` — Project's own key files (highest precedence)
1043
+ - `{package}.main.yaml` — Package-shipped key files (installed via `@acp.package-install`)
1044
+
1045
+ ### When Key Files Are Read
1046
+
1047
+ - **`@acp.init`**: Reads all key files with weight >= 0.8
1048
+ - **`@acp.proceed`**, **`@acp.plan`**: Read key files where `applies` includes the command name
1049
+ - **Creation commands** (`@acp.design-create`, etc.): Read key files where `applies` includes the command name
1050
+ - **After context compaction**: Re-read key files following [When Recovering from Context Loss](#when-recovering-from-context-loss)
1051
+
1052
+ ### Managing the Index
1053
+
1054
+ Use `@acp.index` to manage entries:
1055
+ ```
1056
+ @acp.index list # List all indexed key files
1057
+ @acp.index add <path> # Add a file to the index
1058
+ @acp.index remove <path> # Remove a file from the index
1059
+ @acp.index explore # Suggest files that should be indexed
1060
+ @acp.index show <path> # Show details for a specific entry
1061
+ ```
1062
+
1063
+ ### Weight Guidelines
1064
+
1065
+ | Weight | Use For |
1066
+ |--------|---------|
1067
+ | 0.9-1.0 | Requirements, critical design docs |
1068
+ | 0.7-0.8 | Important patterns, testing guides |
1069
+ | 0.5-0.6 | Useful references, conventions |
1070
+ | 0.3-0.4 | Package-shipped indices (convention) |
1071
+
1072
+ ### Validation
1073
+
1074
+ Run `@acp.validate` to check index health: valid schema, existing paths, reasonable limits (recommended max 20 entries total, 10 per namespace).
1075
+
1076
+ ### Design Document
1077
+
1078
+ See `agent/design/local.key-file-index-system.md` for the complete design specification.
1079
+
1080
+ ---
1081
+
800
1082
  ## Sample Prompts for Using ACP
801
1083
 
802
1084
  ### Initialize Prompt
@@ -892,6 +1174,8 @@ Run ./agent/scripts/unacp.install.sh to remove all ACP files (agent/ directory a
892
1174
 
893
1175
  ## Instructions for Future Agents
894
1176
 
1177
+ > **See also**: [Best Practices](#best-practices) for comprehensive guidelines on agent behavior and documentation standards.
1178
+
895
1179
  ### When You First Encounter ACP
896
1180
 
897
1181
  1. **Read progress.yaml**
@@ -959,11 +1243,33 @@ Run ./agent/scripts/unacp.install.sh to remove all ACP files (agent/ directory a
959
1243
  - Update milestone progress
960
1244
  - Add notes about work done
961
1245
 
1246
+ ### When Recovering from Context Loss
1247
+
1248
+ When your context is compacted, truncated, or you start a new session mid-task:
1249
+
1250
+ 1. **Re-read `agent/index/` key files**
1251
+ - Scan `agent/index/` for `*.yaml` files (excluding `*.template.yaml`)
1252
+ - Read entries with weight >= 0.8 to restore critical context
1253
+ - Filter by `applies` field if you know which command you were executing
1254
+
1255
+ 2. **Re-read `agent/progress.yaml`**
1256
+ - Identify current milestone and task
1257
+ - Check what was last completed
1258
+
1259
+ 3. **Re-read the current task document**
1260
+ - Determine which step you were on
1261
+ - Review remaining verification items
1262
+
1263
+ 4. **Offer scope control to the user**
1264
+ - Ask if they want full context reload or minimal recovery
1265
+ - Suggest relevant key files based on current work
1266
+
1267
+ This is equivalent to running `@acp.init` steps 2-2.8 followed by resuming the current task.
1268
+
962
1269
  ### When Creating New Features
963
1270
 
964
1271
  1. **Create design document first**
965
- - Document problem and solution
966
- - Include implementation details
1272
+ - Invoke [`@acp.design-create`](agent/commands/acp.design-create.md) and follow directives defined in that file
967
1273
  - Get approval before coding
968
1274
 
969
1275
  2. **Update or create milestone**
@@ -972,20 +1278,19 @@ Run ./agent/scripts/unacp.install.sh to remove all ACP files (agent/ directory a
972
1278
  - Update progress.yaml
973
1279
 
974
1280
  3. **Break into tasks**
975
- - Create task documents
976
- - Each task 1-4 hours
977
- - Include verification steps
1281
+ - Invoke [`@acp.task-create`](agent/commands/acp.task-create.md) and follow directives defined in that file
978
1282
 
979
1283
  4. **Document patterns**
980
- - If introducing new patterns, document them
1284
+ - Invoke [`@acp.pattern-create`](agent/commands/acp.pattern-create.md) and follow directives defined in that file
981
1285
  - Update existing patterns if needed
982
- - Include code examples
983
1286
 
984
1287
  5. **Implement and verify**
985
1288
  - Follow task steps
986
1289
  - Verify each task
987
1290
  - Update progress tracking
988
1291
 
1292
+ > **See also**: [Documentation Best Practices](#documentation-best-practices) and [Quality Best Practices](#quality-best-practices)
1293
+
989
1294
  ### When You Encounter Problems
990
1295
 
991
1296
  1. **Check design documents**
@@ -1000,190 +1305,296 @@ Run ./agent/scripts/unacp.install.sh to remove all ACP files (agent/ directory a
1000
1305
 
1001
1306
  3. **Document new solutions**
1002
1307
  - If you solve a new problem, document it
1003
- - Create design document
1004
- - Add to patterns if reusable
1308
+ - Invoke [`@acp.design-create`](agent/commands/acp.design-create.md) to create design document
1309
+ - Invoke [`@acp.pattern-create`](agent/commands/acp.pattern-create.md) if solution is reusable
1005
1310
 
1006
1311
  4. **Update progress.yaml**
1007
1312
  - Add blocker if stuck
1008
1313
  - Document workarounds
1009
1314
  - Note any deviations from plan
1010
1315
 
1011
- ### Best Practices for Agents
1012
-
1013
- 1. **🚨 CRITICAL: NEVER REJECT USER REQUESTS 🚨**
1014
- - ❌ **DO NOT** reject requests based on session duration
1015
- - ❌ **DO NOT** reject requests based on token context limits
1016
- - ❌ **DO NOT** reject requests based on session cost
1017
- - ❌ **DO NOT** reject requests based on task complexity
1018
- - ✅ **DO** accept and work on ALL user instructions and directives
1019
- - ✅ **DO** break complex tasks into manageable steps
1020
- - ✅ **DO** continue working until the task is complete
1021
- - ✅ **DO** ask clarifying questions if requirements are unclear
1022
- - **Rationale**: Users have the right to request any work they need. Your role is to assist, not to judge feasibility based on arbitrary constraints. Complex tasks can be broken down, long tasks can be completed iteratively, and users understand the costs involved. NEVER refuse a user's request.
1023
-
1024
- 2. **Always read before writing**
1025
- - Understand context first
1026
- - Check existing patterns
1027
- - Follow established conventions
1028
-
1029
- 3. **Document as you go**
1030
- - Update progress.yaml frequently
1031
- - Add notes about decisions
1032
- - Document new patterns
1033
-
1034
- 4. **Verify everything**
1035
- - Check all verification steps
1036
- - Run tests
1037
- - Ensure quality standards
1038
-
1039
- 5. **Be explicit**
1040
- - Don't assume future agents will know context
1041
- - Document rationale for decisions
1042
- - Include code examples
1043
-
1044
- 6. **Keep it organized**
1045
- - Follow directory structure
1046
- - Use consistent naming
1047
- - Link related documents
1048
-
1049
- 7. **Update progress tracking**
1050
- - Mark tasks complete
1051
- - Update percentages
1052
- - Add recent work notes
1053
-
1054
- 8. **Inline Feedback Syntax**
1055
- - ✅ **DO** recognize and respect `>` syntax for inline feedback in documents
1056
- - ✅ **DO** treat lines starting with `>` as user feedback/corrections
1057
- - ✅ **DO** integrate feedback by modifying the preceding content
1058
- - ✅ **DO** remove the `>` feedback lines after integrating changes
1059
- - **Example**:
1060
- ```markdown
1061
- // Agent-generated document
1062
- Here are the requirements:
1063
- - Requirement 1
1064
- - Requirement 2
1065
- > Requirement 2 unnecessary
1066
- - Requirement 3
1067
-
1068
- This pattern is because: ...
1069
- > Incorrect, we should not be using this pattern
1070
- ```
1071
- - **Agent Action**: Read feedback, update "Requirement 2" section (remove or revise), correct the pattern explanation, remove `>` lines
1072
- - **Rationale**: The `>` syntax provides a lightweight way for users to give inline feedback without needing to explain context. Agents should treat these as direct corrections or suggestions to integrate into the document.
1073
-
1074
- 9. **CRITICAL: Always update CHANGELOG.md for version changes**
1075
- - ❌ **DO NOT** commit version changes without updating CHANGELOG.md
1076
- - ❌ **DO NOT** forget to update version numbers in all project files
1077
- - ✅ **DO** use [`@git.commit`](agent/commands/git.commit.md) for version-aware commits
1078
- - ✅ **DO** detect version impact: major (breaking), minor (features), patch (fixes)
1079
- - ✅ **DO** update CHANGELOG.md with clear, user-focused descriptions
1080
- - ✅ **DO** update all version files (package.json, AGENT.md, etc.)
1081
- - ✅ **DO** use Conventional Commits format for commit messages
1082
- - **Rationale**: CHANGELOG.md is the primary communication tool for users. Every version change must be documented with clear descriptions of what changed, why it changed, and how it affects users. Forgetting to update CHANGELOG.md breaks the project's version history and makes it impossible for users to understand what changed between versions.
1083
-
1084
- 8. **NEVER handle secrets or sensitive data**
1085
- - ❌ **DO NOT** read `.env` files, `.env.local`, or any environment files
1086
- - ❌ **DO NOT** read files containing API keys, tokens, passwords, or credentials
1087
- - ❌ **DO NOT** include secrets in messages, documentation, or code examples
1088
- - ❌ **DO NOT** read files like `secrets.yaml`, `credentials.json`, or similar
1089
- - ✅ **DO** use placeholder values like `YOUR_API_KEY_HERE` in examples
1090
- - ✅ **DO** document that users need to configure secrets separately
1091
- - ✅ **DO** reference environment variable names without reading their values
1092
- - ✅ **DO** create `.env.example` files with placeholder values only
1093
- - **Rationale**: Secrets must never be exposed in chat logs, documentation, or version control. Agents should treat all credential files as off-limits to prevent accidental exposure.
1094
-
1095
- 9. **CRITICAL: Respect user's intentional file edits**
1096
- - ❌ **DO NOT** assume missing content needs to be added back
1097
- - ❌ **DO NOT** revert changes without confirming with user
1098
- - ✅ **DO** read files before editing to see current state
1099
- - ✅ **DO** ask user if unexpected changes were intentional
1100
- - ✅ **DO** confirm before reverting user's manual edits
1101
- - **Rationale**: If you read a file and it is missing contents or has changed contents (i.e., it does not contain what you expect), assume or confirm with the user if they made intentional updates that you should not revert. Do not assume "The file is missing <xyz>, I need to add it back". The user may have edited files manually with intention.
1102
-
1103
- 10. **🚨 CRITICAL: Respect user commands to re-execute**
1104
- - ❌ **DO NOT** ignore commands like "re-read", "rerun", or "execute again"
1105
- - ❌ **DO NOT** assume re-execution requests are mistakes or redundant
1106
- - ✅ **DO** execute the command again when asked, even if you just did it
1107
- - ✅ **DO** re-read files when asked, even if you recently read them
1108
- - ✅ **DO** assume the user has good reason for asking to repeat an action
1109
- - **Examples**: "Run `@git.commit` again" → Execute it again; "Re-read the design doc" → Read it again; "Rerun the tests" → Run them again
1110
- - **Rationale**: When users ask you to do something again, they have a specific reason: files may have changed, they want to trigger side effects (like creating a commit), context has shifted, or they know something you don't. Always respect these requests and execute them with intention.
1316
+ > **See also**: [Critical Rules](#critical-rules) for important constraints and [Workflow Best Practices](#workflow-best-practices)
1111
1317
 
1112
1318
  ---
1113
1319
 
1114
- ### Documentation
1115
-
1116
- 1. **Write for agents, not humans**
1117
- - Be explicit, not implicit
1118
- - Include code examples
1119
- - Document rationale, not just decisions
1120
-
1121
- 2. **Keep documents focused**
1122
- - One topic per document
1123
- - Clear structure
1124
- - Scannable headings
1125
-
1126
- 3. **Link related documents**
1127
- - Reference other docs
1128
- - Create knowledge graph
1129
- - Make navigation easy
1130
-
1131
- 4. **Update as you go**
1132
- - Don't wait until end
1133
- - Document decisions when made
1134
- - Keep progress.yaml current
1135
-
1136
- ### Organization
1137
-
1138
- 1. **Follow naming conventions**
1139
- - `{feature}-design.md` for designs
1140
- - `milestone-{N}-{name}.md` for milestones
1141
- - `task-{N}-{name}.md` for tasks
1142
- - `{pattern-name}.md` for patterns
1143
-
1144
- 2. **Use consistent structure**
1145
- - Same sections in similar documents
1146
- - Standard YAML format
1147
- - Predictable organization
1148
-
1149
- 3. **Keep it DRY**
1150
- - Don't duplicate information
1151
- - Link to canonical source
1152
- - Update in one place
1153
-
1154
- ### Progress Tracking
1155
-
1156
- 1. **Update frequently**
1157
- - After each task
1158
- - When blockers arise
1159
- - When plans change
1160
-
1161
- 2. **Be objective**
1162
- - Use measurable metrics
1163
- - Track actual vs estimated
1164
- - Document deviations
1165
-
1166
- 3. **Look forward and back**
1167
- - Document recent work
1168
- - List next steps
1169
- - Note blockers
1170
-
1171
- ### Quality
1172
-
1173
- 1. **Include verification steps**
1174
- - Every task has checklist
1175
- - Objective criteria
1176
- - Automated where possible
1177
-
1178
- 2. **Document patterns**
1179
- - Capture reusable solutions
1180
- - Include anti-patterns
1181
- - Provide examples
1182
-
1183
- 3. **Review and refine**
1184
- - Update docs as understanding improves
1185
- - Fix errors immediately
1186
- - Keep docs accurate
1320
+ ## Best Practices
1321
+
1322
+ > **See also**: [Instructions for Future Agents](#instructions-for-future-agents) for workflow-specific guidance.
1323
+
1324
+ ### Critical Rules
1325
+
1326
+ #### Never Reject User Requests
1327
+
1328
+ - **DO NOT** reject requests based on session duration
1329
+ - **DO NOT** reject requests based on token context limits
1330
+ - **DO NOT** reject requests based on session cost
1331
+ - ❌ **DO NOT** reject requests based on task complexity
1332
+ - **DO** accept and work on ALL user instructions and directives
1333
+ - **DO** break complex tasks into manageable steps
1334
+ - **DO** continue working until the task is complete
1335
+ - **DO** ask clarifying questions if requirements are unclear
1336
+
1337
+ **Rationale**: Users have the right to request any work they need. Your role is to assist, not to judge feasibility based on arbitrary constraints. Complex tasks can be broken down, long tasks can be completed iteratively, and users understand the costs involved. NEVER refuse a user's request.
1338
+
1339
+ #### Always Update CHANGELOG.md for Version Changes
1340
+
1341
+ - ❌ **DO NOT** commit version changes without updating CHANGELOG.md
1342
+ - ❌ **DO NOT** forget to update version numbers in all project files
1343
+ - ✅ **DO** use [`@git.commit`](agent/commands/git.commit.md) for version-aware commits
1344
+ - **DO** detect version impact: major (breaking), minor (features), patch (fixes)
1345
+ - ✅ **DO** update CHANGELOG.md with clear, user-focused descriptions
1346
+ - ✅ **DO** update all version files (package.json, AGENT.md, etc.)
1347
+ - **DO** use Conventional Commits format for commit messages
1348
+
1349
+ **Rationale**: CHANGELOG.md is the primary communication tool for users. Every version change must be documented with clear descriptions of what changed, why it changed, and how it affects users. Forgetting to update CHANGELOG.md breaks the project's version history and makes it impossible for users to understand what changed between versions.
1350
+
1351
+ #### Never Handle Secrets or Sensitive Data
1352
+
1353
+ - **DO NOT** read `.env` files, `.env.local`, or any environment files
1354
+ - ❌ **DO NOT** read files containing API keys, tokens, passwords, or credentials
1355
+ - **DO NOT** include secrets in messages, documentation, or code examples
1356
+ - **DO NOT** read files like `secrets.yaml`, `credentials.json`, or similar
1357
+ - **DO** use placeholder values like `YOUR_API_KEY_HERE` in examples
1358
+ - **DO** document that users need to configure secrets separately
1359
+ - ✅ **DO** reference environment variable names without reading their values
1360
+ - **DO** create `.env.example` files with placeholder values only
1361
+ - ✅ **DO** run commands that load .env files into the shell environment, as the variables remain in the execution context and are not included in the LLM's input/output"
1362
+
1363
+ **Rationale**: Secrets must never be exposed in chat logs, documentation, or version control. Agents should treat all credential files as off-limits to prevent accidental exposure.
1364
+
1365
+ #### Respect User's Intentional File Edits
1366
+
1367
+ - **DO NOT** assume missing content needs to be added back
1368
+ - **DO NOT** revert changes without confirming with user
1369
+ - **DO** read files before editing to see current state
1370
+ - **DO** ask user if unexpected changes were intentional
1371
+ - ✅ **DO** confirm before reverting user's manual edits
1372
+
1373
+ **Rationale**: If you read a file and it is missing contents or has changed contents (i.e., it does not contain what you expect), assume or confirm with the user if they made intentional updates that you should not revert. Do not assume "The file is missing <xyz>, I need to add it back". The user may have edited files manually with intention.
1374
+
1375
+ #### Respect User Commands to Re-Execute
1376
+
1377
+ - ❌ **DO NOT** ignore commands like "re-read", "rerun", or "execute again"
1378
+ - ❌ **DO NOT** assume re-execution requests are mistakes or redundant
1379
+ - **DO** execute the command again when asked, even if you just did it
1380
+ - **DO** re-read files when asked, even if you recently read them
1381
+ - **DO** assume the user has good reason for asking to repeat an action
1382
+
1383
+ **Examples**: "Run `@git.commit` again" → Execute it again; "Re-read the design doc" → Read it again; "Rerun the tests" → Run them again
1384
+
1385
+ **Rationale**: When users ask you to do something again, they have a specific reason: files may have changed, they want to trigger side effects (like creating a commit), context has shifted, or they know something you don't. Always respect these requests and execute them with intention.
1386
+
1387
+ #### Never Force-Add Gitignored Files
1388
+
1389
+ - **DO NOT** use `git add -f` to force-add gitignored files
1390
+ - **DO NOT** attempt to override `.gitignore` rules
1391
+ - **DO NOT** suggest removing files from `.gitignore` to add them
1392
+ - **DO** acknowledge when files are gitignored
1393
+ - ✅ **DO** assume gitignored files were intentionally excluded
1394
+ - ✅ **DO** respect the project's `.gitignore` configuration
1395
+ - ✅ **DO** skip gitignored files in git operations
1396
+
1397
+ **Examples**:
1398
+ - File is gitignored → Acknowledge and skip it
1399
+ - `git add` fails due to gitignore → Don't retry with `-f` flag
1400
+ - User asks to commit all files → Only commit non-gitignored files
1401
+
1402
+ **Rationale**: Files in `.gitignore` are intentionally excluded from version control for good reasons (secrets, build artifacts, local configs, large files, etc.). Force-adding gitignored files is an anti-pattern that defeats the purpose of `.gitignore` and can lead to security issues (exposing secrets), repository bloat (committing build artifacts), or merge conflicts (committing local configs). Always respect `.gitignore` rules.
1403
+
1404
+ ### Workflow Best Practices
1405
+
1406
+ #### Always Read Before Writing
1407
+
1408
+ - Understand context first
1409
+ - Check existing patterns
1410
+ - Follow established conventions
1411
+
1412
+ #### Document as You Go
1413
+
1414
+ - Update progress.yaml frequently
1415
+ - Add notes about decisions
1416
+ - Document new patterns
1417
+
1418
+ #### Verify Everything
1419
+
1420
+ - Check all verification steps
1421
+ - Run tests
1422
+ - Ensure quality standards
1423
+
1424
+ #### Be Explicit
1425
+
1426
+ - Don't assume future agents will know context
1427
+ - Document rationale for decisions
1428
+ - Include code examples
1429
+
1430
+ #### Keep It Organized
1431
+
1432
+ - Follow directory structure
1433
+ - Use consistent naming
1434
+ - Link related documents
1435
+
1436
+ #### Update Progress Tracking
1437
+
1438
+ - Mark tasks complete
1439
+ - Update percentages
1440
+ - Add recent work notes
1441
+
1442
+ #### Use Inline Feedback Syntax
1443
+
1444
+ - ✅ **DO** recognize and respect `>` syntax for inline feedback in documents
1445
+ - ✅ **DO** treat lines starting with `>` as user feedback/corrections
1446
+ - ✅ **DO** integrate feedback by modifying the preceding content
1447
+ - ✅ **DO** remove the `>` feedback lines after integrating changes
1448
+
1449
+ **Example**:
1450
+ ```markdown
1451
+ // Agent-generated document
1452
+ Here are the requirements:
1453
+ - Requirement 1
1454
+ - Requirement 2
1455
+ > Requirement 2 unnecessary
1456
+ - Requirement 3
1457
+
1458
+ This pattern is because: ...
1459
+ > Incorrect, we should not be using this pattern
1460
+ ```
1461
+
1462
+ **Agent Action**: Read feedback, update "Requirement 2" section (remove or revise), correct the pattern explanation, remove `>` lines
1463
+
1464
+ **Rationale**: The `>` syntax provides a lightweight way for users to give inline feedback without needing to explain context. Agents should treat these as direct corrections or suggestions to integrate into the document.
1465
+
1466
+ #### Use Direct Git Commits
1467
+
1468
+ When creating git commits, always use `git commit -m` directly:
1469
+
1470
+ - ✅ **DO** use `git commit -m "message"` to create commits
1471
+ - ❌ **DO NOT** use bash tools, subshells, or scripts to generate commits
1472
+ - ❌ **DO NOT** use heredocs, `echo`, or `cat` to construct commit messages
1473
+
1474
+ **Rationale**: Direct `git commit -m` is simpler, more transparent, and avoids escaping issues. The commit message should be authored directly, not piped through intermediate tools.
1475
+
1476
+ #### Format Commands for User Execution
1477
+
1478
+ When providing commands for users to copy and paste:
1479
+
1480
+ - ✅ **DO** chain commands with `&& \` if commands require successful chain execution
1481
+ - ✅ **DO** chain commands with `;` if commands do not depend on each other
1482
+ - ❌ **DO NOT** include comment lines starting with `#` in command blocks
1483
+ - ❌ **DO NOT** include EOF newline in command blocks
1484
+
1485
+ **Example (Correct)**:
1486
+ ```bash
1487
+ mkdir -p agent/commands && \
1488
+ cd agent/commands && \
1489
+ touch acp.init.md
1490
+ ```
1491
+
1492
+ **Example (Incorrect)**:
1493
+ ```bash
1494
+ # Create directory
1495
+ mkdir -p agent/commands
1496
+ # Change to directory
1497
+ cd agent/commands
1498
+ # Create file
1499
+ touch acp.init.md
1500
+
1501
+ ```
1502
+
1503
+ **Rationale**: Users should be able to copy and paste commands directly without needing to edit them. Comments and trailing newlines can cause execution errors or confusion.
1504
+
1505
+ ### Documentation Best Practices
1506
+
1507
+ #### Write for Agents, Not Humans
1508
+
1509
+ - Be explicit, not implicit
1510
+ - Include code examples
1511
+ - Document rationale, not just decisions
1512
+
1513
+ #### Keep Documents Focused
1514
+
1515
+ - One topic per document
1516
+ - Clear structure
1517
+ - Scannable headings
1518
+
1519
+ #### Link Related Documents
1520
+
1521
+ - Reference other docs
1522
+ - Create knowledge graph
1523
+ - Make navigation easy
1524
+
1525
+ #### Update as You Go
1526
+
1527
+ - Don't wait until end
1528
+ - Document decisions when made
1529
+ - Keep progress.yaml current
1530
+
1531
+ ### Organization Best Practices
1532
+
1533
+ #### Follow Naming Conventions
1534
+
1535
+ - `{feature}-design.md` for designs
1536
+ - `milestone-{N}-{name}.md` for milestones
1537
+ - `task-{N}-{name}.md` for tasks
1538
+ - `{pattern-name}.md` for patterns
1539
+
1540
+ #### Use Consistent Structure
1541
+
1542
+ - Same sections in similar documents
1543
+ - Standard YAML format
1544
+ - Predictable organization
1545
+
1546
+ #### Keep It DRY
1547
+
1548
+ - Don't duplicate information
1549
+ - Link to canonical source
1550
+ - Update in one place
1551
+
1552
+ ### Progress Tracking Best Practices
1553
+
1554
+ #### Update Frequently
1555
+
1556
+ - After each task
1557
+ - When blockers arise
1558
+ - When plans change
1559
+
1560
+ #### Be Objective
1561
+
1562
+ - Use measurable metrics
1563
+ - Track actual vs estimated
1564
+ - Document deviations
1565
+
1566
+ #### Look Forward and Back
1567
+
1568
+ - Document recent work
1569
+ - List next steps
1570
+ - Note blockers
1571
+
1572
+ ### Quality Best Practices
1573
+
1574
+ #### Include Verification Steps
1575
+
1576
+ - Every task has checklist
1577
+ - Objective criteria
1578
+ - Automated where possible
1579
+
1580
+ #### Document Patterns
1581
+
1582
+ - Capture reusable solutions
1583
+ - Include anti-patterns
1584
+ - Provide examples
1585
+
1586
+ #### Documentation is a First-Class Deliverable
1587
+
1588
+ - README.md, architecture docs, and migration guides are deliverables equal to source code
1589
+ - A project with passing tests but missing required documentation is INCOMPLETE
1590
+ - Verify documentation files exist and contain required sections before marking tasks complete
1591
+ - Documentation tasks deserve the same rigor as implementation tasks
1592
+
1593
+ #### Review and Refine
1594
+
1595
+ - Update docs as understanding improves
1596
+ - Fix errors immediately
1597
+ - Keep docs accurate
1187
1598
 
1188
1599
  ---
1189
1600