11# periscope Development Patterns
22
3- > Synthesized from two ECC repository-analysis runs and verified against the
4- > repository's documented architecture and test layout.
3+ > Synthesized from ECC repository-analysis runs (PR #16 harmonization + PR #18
4+ > additive replay) and verified against the repository's documented architecture
5+ > and test layout.
56
67## Overview
78
@@ -38,13 +39,17 @@ export function getUserProfile(id: string) {
3839
3940- Use Conventional Commits.
4041- Choose the prefix that describes the change; observed prefixes include
41- ` build ` , ` chore ` , and ` fix ` .
42+ ` build ` , ` chore ` , ` docs ` , ` feat ` , ` fix ` , and scoped variants such as
43+ ` fix(frontend) ` and ` fix(desktop) ` .
4244- Keep the subject concise and include a scope when it adds useful context.
4345
4446``` text
4547build(deps): update frontend dependencies
4648fix(desktop): honor PERISCOPE_VERSION override
4749chore(git): sync attribution guard scripts
50+ docs: align layer-2 synthesis analysis tip SHA
51+ fix(frontend): remove stale ActivityMinimap and pass svelte-check
52+ feat(parser): add session discovery for a new agent
4853```
4954
5055## Workflows
@@ -82,6 +87,111 @@ chore(git): sync attribution guard scripts
82874 . Run the checks for each affected subsystem.
83885 . Commit the manifest and lockfile together with a ` build(deps) ` subject.
8489
90+ ### Integration Analysis Doc
91+
92+ ** Trigger:** When updating layer-2 integrative synthesis verification or tip SHA
93+
94+ ** Guide:** ` /update-integration-analysis `
95+
96+ ** Instinct:** ` periscope-workflow-update-integration-analysis-doc ` — numbered
97+ workflow steps; trigger: "when doing update integration analysis doc".
98+
99+ 1 . Edit ` docs/INTEGRATION-SYNTHESIS-LAYER2-ANALYSIS.md ` for verification gates,
100+ branch references, or tip SHA alignment.
101+ 2 . Use a ` docs: ` Conventional Commit subject that names the alignment work.
102+ 3 . Keep the analysis consistent with the current ` merged ` integration line.
103+
104+ ### Add New Agent Integration
105+
106+ ** Trigger:** When adding support for a new AI agent parser/discovery path
107+
108+ ** Guide:** ` /add-new-agent-integration ` (instinct:
109+ ` periscope-workflow-add-new-agent-integration ` )
110+
111+ 1 . Implement a parser in ` internal/parser/{agent}.go ` with
112+ ` internal/parser/{agent}_test.go ` .
113+ 2 . Add discovery logic in ` internal/parser/discovery.go ` .
114+ 3 . Update normalization in ` internal/parser/types.go ` and ` taxonomy.go ` .
115+ 4 . Wire the agent into ` internal/sync/engine.go ` and integration tests.
116+ 5 . Update agent directory/env configuration in ` internal/config/config.go ` .
117+ 6 . Update frontend agent metadata in ` frontend/src/lib/utils/agents.ts ` and
118+ related UI filters.
119+ 7 . Update documentation (` README.md ` , ` AGENTS.md ` ) when user-facing behavior
120+ changes.
121+
122+ ### Add New Feature (Full Stack)
123+
124+ ** Trigger:** When implementing a user-facing feature spanning backend and UI
125+
126+ ** Guide:** ` /add-new-feature-full-stack ` (instinct:
127+ ` periscope-workflow-add-new-feature-full-stack ` )
128+
129+ 1 . Design and implement DB schema changes in ` internal/db/schema.sql ` and
130+ ` internal/db/*.go ` .
131+ 2 . Add or update backend logic in ` internal/server/ ` and ` internal/sync/ ` .
132+ 3 . Expose API endpoints in ` internal/server/ ` .
133+ 4 . Implement Svelte components/stores under ` frontend/src/lib/ ` .
134+ 5 . Update frontend types under ` frontend/src/lib/api/types/ ` .
135+ 6 . Add or update unit and e2e tests for the touched subsystems.
136+ 7 . Update docs when operator or contributor behavior changes.
137+
138+ ### Backend Bugfix with Test
139+
140+ ** Trigger:** When fixing backend logic
141+
142+ ** Guide:** ` /backend-bugfix-with-test ` (instinct:
143+ ` periscope-instinct-backend-bugfix-with-test ` )
144+
145+ 1 . Fix the bug in the relevant Go package under ` internal/ ` .
146+ 2 . Add or update a regression test in the colocated ` *_test.go ` file.
147+ 3 . Run targeted and affected package tests before handoff.
148+
149+ ### Frontend Bugfix with Test
150+
151+ ** Trigger:** When fixing frontend UI or store logic
152+
153+ ** Guide:** ` /frontend-bugfix-with-test ` (instinct:
154+ ` periscope-instinct-frontend-bugfix-with-test ` )
155+
156+ 1 . Fix the bug in the relevant Svelte/TypeScript module.
157+ 2 . Add or update a Vitest or Playwright test as appropriate.
158+ 3 . Run ` cd frontend && npm test ` and any affected e2e journeys.
159+
160+ ### Refactor and Test Split
161+
162+ ** Trigger:** When test files become large or mixed across concerns
163+
164+ ** Guide:** ` /refactoring ` (command scaffold:
165+ ` .claude/commands/refactoring.md ` )
166+
167+ 1 . Identify oversized or mixed test files.
168+ 2 . Split into per-agent or per-feature test files.
169+ 3 . Move or create fixtures under ` internal/parser/testdata/ ` when needed.
170+ 4 . Verify all tests still pass.
171+
172+ ### Database Schema Migration and Sync
173+
174+ ** Trigger:** When changing or extending the SQLite schema
175+
176+ ** Guide:** ` /database-migration ` (command scaffold:
177+ ` .claude/commands/database-migration.md ` )
178+
179+ 1 . Edit ` internal/db/schema.sql ` and related Go structs/queries.
180+ 2 . Update sync logic in ` internal/sync/ ` when ingestion behavior changes.
181+ 3 . Add or update tests in ` internal/db/*_test.go ` and sync integration tests.
182+ 4 . Handle resync/migration semantics without destroying archived session data.
183+ 5 . Update frontend types when API payloads change.
184+
185+ ### Feature Development Scaffold
186+
187+ ** Trigger:** When starting a multi-file feature with unclear boundaries
188+
189+ ** Guide:** ` /feature-development ` (command scaffold:
190+ ` .claude/commands/feature-development.md ` )
191+
192+ Use the scaffold to sequence discovery, smallest coherent change, verification,
193+ and handoff notes before expanding scope.
194+
85195### Testing
86196
87197** Trigger:** When verifying correctness
@@ -102,6 +212,7 @@ chore(git): sync attribution guard scripts
102212- PostgreSQL integration tests use the ` pgtest ` build tag and a dedicated test
103213 database.
104214- Use ` t.TempDir() ` for isolated Go test data.
215+ - Use ` internal/parser/testdata/ ` for parser fixtures.
105216
106217## Verified Commands
107218
@@ -113,3 +224,11 @@ chore(git): sync attribution guard scripts
113224| ` make e2e ` | Run Playwright end-to-end tests |
114225| ` make vet ` | Run Go static checks |
115226| ` make lint ` | Run configured Go linters |
227+
228+ ## Workflow Command Scaffolds
229+
230+ | Command | Scaffold path |
231+ | --- | --- |
232+ | ` /database-migration ` | ` .claude/commands/database-migration.md ` |
233+ | ` /feature-development ` | ` .claude/commands/feature-development.md ` |
234+ | ` /refactoring ` | ` .claude/commands/refactoring.md ` |
0 commit comments