stagent 0.3.1 → 0.3.3

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.
Files changed (42) hide show
  1. package/dist/cli.js +2 -0
  2. package/docs/.last-generated +1 -0
  3. package/docs/features/agent-intelligence.md +60 -0
  4. package/docs/features/chat.md +119 -0
  5. package/docs/features/cost-usage.md +61 -0
  6. package/docs/features/dashboard-kanban.md +73 -0
  7. package/docs/features/design-system.md +73 -0
  8. package/docs/features/documents.md +76 -0
  9. package/docs/features/home-workspace.md +66 -0
  10. package/docs/features/inbox-notifications.md +67 -0
  11. package/docs/features/keyboard-navigation.md +62 -0
  12. package/docs/features/monitoring.md +59 -0
  13. package/docs/features/playbook.md +57 -0
  14. package/docs/features/profiles.md +57 -0
  15. package/docs/features/projects.md +67 -0
  16. package/docs/features/provider-runtimes.md +49 -0
  17. package/docs/features/schedules.md +68 -0
  18. package/docs/features/settings.md +85 -0
  19. package/docs/features/shared-components.md +78 -0
  20. package/docs/features/tool-permissions.md +57 -0
  21. package/docs/features/workflows.md +81 -0
  22. package/docs/getting-started.md +141 -0
  23. package/docs/index.md +50 -0
  24. package/docs/journeys/developer.md +303 -0
  25. package/docs/journeys/personal-use.md +209 -0
  26. package/docs/journeys/power-user.md +248 -0
  27. package/docs/journeys/work-use.md +226 -0
  28. package/docs/manifest.json +240 -0
  29. package/package.json +2 -1
  30. package/src/app/api/environment/checkpoints/[id]/route.ts +3 -2
  31. package/src/app/api/environment/checkpoints/route.ts +2 -1
  32. package/src/app/api/environment/scan/route.ts +2 -1
  33. package/src/lib/agents/claude-agent.ts +3 -2
  34. package/src/lib/agents/runtime/claude.ts +4 -3
  35. package/src/lib/agents/runtime/openai-codex.ts +4 -3
  36. package/src/lib/chat/engine.ts +2 -1
  37. package/src/lib/chat/model-discovery.ts +2 -1
  38. package/src/lib/docs/reader.ts +11 -1
  39. package/src/lib/environment/scanner.ts +2 -1
  40. package/src/lib/environment/sync/mcp-sync.ts +2 -1
  41. package/src/lib/environment/sync-engine.ts +2 -1
  42. package/src/lib/environment/workspace-context.ts +6 -1
@@ -0,0 +1,226 @@
1
+ ---
2
+ title: "Work Use Guide"
3
+ category: "user-journey"
4
+ persona: "work"
5
+ difficulty: "intermediate"
6
+ estimatedTime: "30 minutes"
7
+ sections: ["projects", "chat", "documents", "workflows", "schedules", "cost-usage", "inbox-notifications"]
8
+ tags: ["intermediate", "team", "documents", "workflows", "schedules", "costs", "inbox"]
9
+ lastUpdated: "2026-03-22"
10
+ ---
11
+
12
+ # Work Use Guide
13
+
14
+ Meet Jordan, a team lead managing a cross-functional product team. Jordan juggles multiple workstreams, uploads reference documents for agents to consult, orchestrates multi-step workflows, schedules recurring automations, tracks API spend, and triages permission requests from running agents. This guide walks through a full working session -- from organizing projects to clearing the inbox at end of day.
15
+
16
+ ## Prerequisites
17
+
18
+ - Stagent installed and running locally (`npm run dev`)
19
+ - An Anthropic API key configured in `.env.local`
20
+ - At least one project already created (see [Personal Use Guide](./personal-use.md) if starting fresh)
21
+ - A document to upload (PDF, text file, image, Word doc, or spreadsheet)
22
+
23
+ ## Journey Steps
24
+
25
+ ### Step 1: Organize Team Projects
26
+
27
+ Jordan starts the morning by reviewing the team's active projects. The projects list provides a quick snapshot of every workstream -- status indicators, task counts, and last activity -- so Jordan can decide where to focus first.
28
+
29
+ ![Projects list showing team workstreams with status and task counts](../screengrabs/projects-list.png)
30
+
31
+ 1. Click **Projects** in the sidebar under the **Work** group
32
+ 2. Scan the project cards for status badges, task counts, and recent activity timestamps
33
+ 3. Click **Create Project** to set up a new workstream -- enter a descriptive name like "Q2 2026 Product Planning," a detailed description covering scope and stakeholders, and a working directory pointing to the shared team repository
34
+ 4. Click **Create Project** to save
35
+
36
+ > **Tip:** Include team conventions in the project description -- for example, "All output should follow our RFC template format." Agents reference this description when executing tasks, so richer context produces better results.
37
+
38
+ ### Step 2: Drill Into Project Details
39
+
40
+ Jordan clicks into the planning project to check on task progress and verify that agents are producing quality output. The project detail page shows all tasks scoped to that workstream, along with project metadata.
41
+
42
+ ![Project detail page showing tasks, metadata, and progress](../screengrabs/projects-detail.png)
43
+
44
+ 1. Click on a project card from the projects list to open its detail page
45
+ 2. Review the **task list** -- each task shows its status, assigned agent profile, and last update
46
+ 3. Check completed tasks and verify their output quality
47
+ 4. Reassign or edit any tasks that need course correction
48
+ 5. Use the project description and working directory fields to confirm agents have the right context
49
+
50
+ > **Tip:** Project-scoped views filter out noise from other workstreams. Use them when you need to focus on a single initiative without distractions from the rest of the workspace.
51
+
52
+ ### Step 3: Query Workspace Status via Chat
53
+
54
+ Rather than clicking through every page, Jordan opens Chat to ask a quick question about project status. Chat pulls context from projects, tasks, and documents to give informed, conversational answers with clickable links back to the relevant items.
55
+
56
+ ![Active chat conversation with messages and Quick Access navigation pills](../screengrabs/chat-conversation.png)
57
+
58
+ 1. Click **Chat** in the sidebar under the **Work** group
59
+ 2. Type a question such as "What is the status of the Q2 planning project?"
60
+ 3. Review the AI response -- notice the **Quick Access pills** that link to specific projects, tasks, or documents mentioned in the answer
61
+ 4. Click a Quick Access pill to jump directly to the referenced item
62
+ 5. Use the **conversation sidebar** on the left to revisit previous chat sessions or start a new one
63
+
64
+ > **Tip:** Chat is the fastest way to get a cross-cutting status overview. Instead of navigating five different pages, ask one question and follow the entity links in the response. Previous conversations are saved so you can pick up where you left off.
65
+
66
+ ### Step 4: Upload and Manage Documents
67
+
68
+ Jordan needs to upload reference documents -- a product requirements doc and competitive analysis -- that agents will consult during planning tasks. The documents section manages all files across the workspace.
69
+
70
+ ![Documents table view with file type icons and metadata columns](../screengrabs/documents-list.png)
71
+
72
+ 1. Click **Documents** in the sidebar under the **Manage** group
73
+ 2. Review existing documents in the **table view** -- columns show file name, type, size, project association, and upload date
74
+ 3. Click the **Upload** button in the page header
75
+ 4. Select one or more files from the file picker (supports PDF, text, images, Word documents, and spreadsheets)
76
+ 5. Assign the documents to the appropriate project
77
+ 6. Click **Upload** to process and store the files
78
+
79
+ > **Tip:** Stagent automatically extracts text from uploaded documents. PDFs, Word files, and even images are processed so agents can search and reference their contents during task execution -- no manual copy-paste needed.
80
+
81
+ ### Step 5: Switch Document Views
82
+
83
+ Jordan switches to the grid view for a visual overview of all uploaded files. The grid layout surfaces thumbnail previews and makes it easy to spot file types at a glance.
84
+
85
+ ![Documents grid view with card layout showing file previews](../screengrabs/documents-grid.png)
86
+
87
+ 1. Click the **grid toggle** in the documents page header to switch from table to grid view
88
+ 2. Browse document cards -- each card shows the file name, type icon, size, and project association
89
+ 3. Click any card to open its detail sheet with full metadata and a preview of extracted text
90
+ 4. Toggle back to **table view** when you need to sort or filter by specific columns
91
+
92
+ > **Tip:** Grid view works well for visual scanning when you have a mix of file types. Table view is better for precise filtering and sorting across large document libraries.
93
+
94
+ ### Step 6: Browse Workflow Blueprints
95
+
96
+ Jordan wants to set up a structured review process for the planning project. The blueprint gallery offers pre-built workflow templates for common team processes -- no need to build from scratch.
97
+
98
+ ![Workflow blueprint gallery showing template cards for team processes](../screengrabs/workflows-blueprints.png)
99
+
100
+ 1. Click **Workflows** in the sidebar under the **Manage** group
101
+ 2. Navigate to the **Blueprints** tab to open the template gallery
102
+ 3. Browse the available blueprint cards -- each describes the workflow's purpose, step count, and recommended agent profiles
103
+ 4. Click a blueprint that matches your needs (e.g., "Research & Report" or "Code Review Pipeline")
104
+ 5. Customize the template by adjusting step descriptions, agent assignments, and project scope
105
+ 6. Click **Create Workflow** to instantiate it
106
+
107
+ > **Tip:** Blueprints are starting points, not rigid templates. After creating a workflow from a blueprint, you can add, remove, or reorder steps to match your team's specific process.
108
+
109
+ ### Step 7: Review Active Workflows
110
+
111
+ After launching several workflows, Jordan checks back to see which ones have completed, which are still running, and whether any steps need attention.
112
+
113
+ ![Workflows list with tabs showing status and step progress](../screengrabs/workflows-list.png)
114
+
115
+ 1. Return to the **Workflows** page and select the **All** or **Runs** tab
116
+ 2. Scan the workflow list -- each entry shows its name, status, step progress, and last activity
117
+ 3. Click on a running workflow to see step-by-step execution details
118
+ 4. Check for any steps marked as "waiting" that may need input or approval
119
+ 5. Review completed workflows to verify their output quality
120
+
121
+ > **Tip:** Workflows with steps in a "waiting" state often need human input or a permission approval. Cross-reference with the Inbox to see if an agent is blocked on a tool permission request.
122
+
123
+ ### Step 8: Schedule Recurring Automations
124
+
125
+ Jordan wants a weekly status summary generated every Monday morning without manual intervention. Schedules let you configure recurring agent tasks that run on autopilot.
126
+
127
+ ![Schedules list showing active schedules with frequency and next firing time](../screengrabs/schedules-list.png)
128
+
129
+ 1. Click **Schedules** in the sidebar under the **Manage** group
130
+ 2. Click **Create Schedule** to open the creation form
131
+ 3. Enter a **Name** such as "Weekly Status Report"
132
+ 4. Set the **Interval** using natural language -- "every Monday at 9am," "every weekday at 5pm," or "every 2 hours"
133
+ 5. Configure the **Task Template** with a title, description, target project, and agent profile
134
+ 6. Enable the schedule toggle and click **Create**
135
+
136
+ > **Tip:** The interval parser understands plain English. You do not need to write cron expressions -- just describe the cadence in natural language and Stagent translates it.
137
+
138
+ ### Step 9: Monitor Spending and Budgets
139
+
140
+ With multiple agents running tasks and scheduled jobs throughout the week, Jordan checks the cost dashboard to ensure the team stays within budget. Visible spend is governed spend.
141
+
142
+ ![Cost and Usage dashboard showing spend metrics and budget gauges](../screengrabs/cost-usage-list.png)
143
+
144
+ 1. Click **Costs & Usage** in the sidebar under the **Configure** group
145
+ 2. Review the **total spend** for the current billing period at the top of the page
146
+ 3. Check the **budget gauge** to see how close the team is to the configured spend cap
147
+ 4. Examine the **per-project breakdown** to identify which workstreams consume the most tokens
148
+ 5. Review the **per-model breakdown** to understand cost distribution across different AI models
149
+
150
+ > **Tip:** If costs are climbing faster than expected, check for tasks with very large document contexts or autonomous loops with high iteration counts. Both are common sources of unexpected token consumption.
151
+
152
+ ### Step 10: Analyze Cost Breakdown
153
+
154
+ Jordan scrolls down to the detailed usage table for a granular view of individual cost entries -- which tasks consumed how many tokens, when, and at what price.
155
+
156
+ ![Cost and Usage page scrolled to show detailed usage breakdown table](../screengrabs/cost-usage-below-fold.png)
157
+
158
+ 1. Scroll below the summary cards to reach the **usage breakdown table**
159
+ 2. Review individual entries showing task name, model used, token counts (input and output), and computed cost
160
+ 3. Sort by cost or date to find the most expensive operations
161
+ 4. Use this data to identify optimization opportunities -- tasks that could use a smaller model or tighter context windows
162
+
163
+ > **Tip:** The breakdown table is your audit trail. When a stakeholder asks "why did we spend $X this week," you can trace every dollar back to a specific task and model invocation.
164
+
165
+ ### Step 11: Review Agent Notifications
166
+
167
+ Jordan's agents have been running tasks in the background, and some have hit permission boundaries or completed important milestones. The Inbox is Stagent's human-in-the-loop control center.
168
+
169
+ ![Inbox notification queue with tabs and action buttons](../screengrabs/inbox-list.png)
170
+
171
+ 1. Click **Inbox** in the sidebar under the **Work** group
172
+ 2. Review the notification list -- each entry summarizes what an agent needs or has accomplished
173
+ 3. Notifications are sorted by urgency, with permission requests at the top
174
+ 4. Check the **badge count** on the Inbox sidebar item to see how many unread notifications are waiting
175
+
176
+ > **Tip:** A badge on the Inbox sidebar item shows the count of unread notifications. When agents are actively running, check this regularly to avoid leaving them blocked on a permission request.
177
+
178
+ ### Step 12: Inspect Notification Details
179
+
180
+ Jordan expands a notification to see the full details of a permission request -- what the agent wants to do, which tool it needs access to, and the specific arguments it plans to use.
181
+
182
+ ![Inbox with expanded notification showing full content and approval options](../screengrabs/inbox-expanded.png)
183
+
184
+ 1. Click on a notification row to expand it and reveal the full content
185
+ 2. For permission requests, review the **action details** -- the tool name, arguments, and why the agent needs it
186
+ 3. Choose **Approve** to let the agent proceed, or **Deny** to block the action
187
+ 4. For routine tools you trust, use the **Always Allow** option to grant standing permission and reduce future notification noise
188
+ 5. For status notifications, read the completion summary and click through to the related task if needed
189
+
190
+ > **Tip:** When you grant "Always Allow" for a tool, the agent will never pause for that action again. Start conservative -- approve one at a time -- and gradually open up permissions as you build confidence in agent behavior. You can always tighten permissions later from the Settings page.
191
+
192
+ ### Step 13: Manage Schedules
193
+
194
+ Later in the week, Jordan revisits the schedules list to verify that the Monday report ran successfully and to adjust the next firing time for an upcoming holiday.
195
+
196
+ ![Schedules list with status indicators and next run timestamps](../screengrabs/schedules-list.png)
197
+
198
+ 1. Return to **Schedules** in the sidebar
199
+ 2. Locate the "Weekly Status Report" schedule entry
200
+ 3. Check the **Last Run** and **Next Run** timestamps to confirm execution
201
+ 4. Click the schedule to review its firing history and the tasks it generated
202
+ 5. Edit the interval or pause the schedule if adjustments are needed
203
+
204
+ > **Tip:** Schedules create real tasks each time they fire. You can find the generated tasks in the project's task list or on the Dashboard, making it easy to review and audit automated output.
205
+
206
+ ### Step 14: Review Workflow Results
207
+
208
+ At the end of the work cycle, Jordan checks completed workflows to review the deliverables agents produced and confirm they meet team standards.
209
+
210
+ ![Workflows list showing completed workflow runs](../screengrabs/workflows-list.png)
211
+
212
+ 1. Navigate to **Workflows** and filter for **completed** runs
213
+ 2. Click on a completed workflow to open its detail view
214
+ 3. Walk through each step's output -- review generated documents, analysis results, or code changes
215
+ 4. Flag any steps that need revision and kick off a follow-up task if needed
216
+ 5. Archive workflows that are fully reviewed and accepted
217
+
218
+ > **Tip:** Treat completed workflows as deliverables. Review them with the same rigor you would apply to a team member's work product -- agents benefit from the same feedback loop that helps humans improve.
219
+
220
+ ### Step 15: What's Next
221
+
222
+ Jordan's working session covered the full breadth of Stagent's team-oriented features -- from project organization through cost governance and inbox management. To go deeper:
223
+
224
+ - [Power User Guide](./power-user.md) -- Build multi-step autonomous workflows, configure agent loops, and orchestrate multi-agent swarms
225
+ - [Developer Guide](./developer.md) -- Configure authentication, runtime settings, environment scanning, and CLI tooling
226
+ - [Personal Use Guide](./personal-use.md) -- Review the basics of project creation, task management, and single-agent execution
@@ -0,0 +1,240 @@
1
+ {
2
+ "generated": "2026-03-21T21:00:00Z",
3
+ "version": 1,
4
+ "sections": [
5
+ {
6
+ "slug": "home-workspace",
7
+ "title": "Home & Workspace",
8
+ "category": "feature-reference",
9
+ "path": "features/home-workspace.md",
10
+ "route": "/",
11
+ "tags": ["home", "workspace", "briefing", "stat-cards", "activity-feed"],
12
+ "features": ["homepage-dashboard", "micro-visualizations"],
13
+ "screengrabCount": 2
14
+ },
15
+ {
16
+ "slug": "dashboard-kanban",
17
+ "title": "Dashboard & Kanban",
18
+ "category": "feature-reference",
19
+ "path": "features/dashboard-kanban.md",
20
+ "route": "/dashboard",
21
+ "tags": ["kanban", "tasks", "ai-assist", "board", "drag-and-drop"],
22
+ "features": ["task-board", "task-definition-ai", "kanban-board-operations", "board-context-persistence", "ai-assist-workflow-creation", "detail-view-redesign"],
23
+ "screengrabCount": 4
24
+ },
25
+ {
26
+ "slug": "inbox-notifications",
27
+ "title": "Inbox & Notifications",
28
+ "category": "feature-reference",
29
+ "path": "features/inbox-notifications.md",
30
+ "route": "/inbox",
31
+ "tags": ["inbox", "approvals", "notifications", "human-in-the-loop", "progressive-disclosure"],
32
+ "features": ["inbox-notifications", "ambient-approval-toast", "rich-content-rendering"],
33
+ "screengrabCount": 2
34
+ },
35
+ {
36
+ "slug": "chat",
37
+ "title": "Chat",
38
+ "category": "feature-reference",
39
+ "path": "features/chat.md",
40
+ "route": "/chat",
41
+ "tags": ["chat", "conversations", "ai", "model-selection", "suggested-prompts", "quick-access"],
42
+ "features": ["chat-data-layer", "chat-engine", "chat-api-routes", "chat-ui-shell", "chat-message-rendering", "chat-input-composer"],
43
+ "screengrabCount": 5
44
+ },
45
+ {
46
+ "slug": "projects",
47
+ "title": "Projects",
48
+ "category": "feature-reference",
49
+ "path": "features/projects.md",
50
+ "route": "/projects",
51
+ "tags": ["projects", "workspaces", "task-grouping", "file-context"],
52
+ "features": ["project-management", "working-directory-context"],
53
+ "screengrabCount": 3
54
+ },
55
+ {
56
+ "slug": "workflows",
57
+ "title": "Workflows",
58
+ "category": "feature-reference",
59
+ "path": "features/workflows.md",
60
+ "route": "/workflows",
61
+ "tags": ["workflows", "orchestration", "blueprints", "parallel", "swarm", "step-builder"],
62
+ "features": ["workflow-engine", "workflow-blueprints", "parallel-research-fork-join", "multi-agent-swarm", "autonomous-loop-execution", "workflow-ux-overhaul"],
63
+ "screengrabCount": 5
64
+ },
65
+ {
66
+ "slug": "documents",
67
+ "title": "Documents",
68
+ "category": "feature-reference",
69
+ "path": "features/documents.md",
70
+ "route": "/documents",
71
+ "tags": ["documents", "upload", "preprocessing", "agent-context", "extraction"],
72
+ "features": ["document-manager", "file-attachment-data-layer", "document-preprocessing", "agent-document-context", "document-output-generation"],
73
+ "screengrabCount": 3
74
+ },
75
+ {
76
+ "slug": "monitoring",
77
+ "title": "Monitor",
78
+ "category": "feature-reference",
79
+ "path": "features/monitoring.md",
80
+ "route": "/monitor",
81
+ "tags": ["monitoring", "logs", "streaming", "execution-tracking"],
82
+ "features": ["monitoring-dashboard", "live-log-streaming"],
83
+ "screengrabCount": 2
84
+ },
85
+ {
86
+ "slug": "profiles",
87
+ "title": "Profiles",
88
+ "category": "feature-reference",
89
+ "path": "features/profiles.md",
90
+ "route": "/profiles",
91
+ "tags": ["profiles", "agents", "routing", "catalog", "auto-routing"],
92
+ "features": ["multi-agent-routing", "agent-profile-catalog", "agent-self-improvement", "learned-context-ux-completion", "cross-provider-profile-compatibility", "profile-surface-stability"],
93
+ "screengrabCount": 3
94
+ },
95
+ {
96
+ "slug": "schedules",
97
+ "title": "Schedules",
98
+ "category": "feature-reference",
99
+ "path": "features/schedules.md",
100
+ "route": "/schedules",
101
+ "tags": ["schedules", "cron", "recurring", "autonomous-loops", "automation"],
102
+ "features": ["scheduled-prompt-loops", "autonomous-loop-execution"],
103
+ "screengrabCount": 3
104
+ },
105
+ {
106
+ "slug": "cost-usage",
107
+ "title": "Cost & Usage",
108
+ "category": "feature-reference",
109
+ "path": "features/cost-usage.md",
110
+ "route": "/costs",
111
+ "tags": ["cost", "usage", "metering", "budgets", "guardrails"],
112
+ "features": ["usage-metering-ledger", "spend-budget-guardrails", "cost-and-usage-dashboard"],
113
+ "screengrabCount": 2
114
+ },
115
+ {
116
+ "slug": "settings",
117
+ "title": "Settings",
118
+ "category": "feature-reference",
119
+ "path": "features/settings.md",
120
+ "route": "/settings",
121
+ "tags": ["settings", "authentication", "permissions", "presets", "budgets"],
122
+ "features": ["session-management", "tool-permission-persistence", "tool-permission-presets", "data-management"],
123
+ "screengrabCount": 2
124
+ },
125
+ {
126
+ "slug": "playbook",
127
+ "title": "Playbook",
128
+ "category": "feature-reference",
129
+ "path": "features/playbook.md",
130
+ "route": "/playbook",
131
+ "tags": ["playbook", "documentation", "in-app-help"],
132
+ "features": ["in-app-documentation"],
133
+ "screengrabCount": 1
134
+ },
135
+ {
136
+ "slug": "provider-runtimes",
137
+ "title": "Provider Runtimes",
138
+ "category": "cross-cutting",
139
+ "path": "features/provider-runtimes.md",
140
+ "route": "cross-cutting",
141
+ "tags": ["runtimes", "claude", "openai", "codex", "providers", "architecture"],
142
+ "features": ["provider-runtime-abstraction", "openai-codex-app-server", "agent-integration"],
143
+ "screengrabCount": 1
144
+ },
145
+ {
146
+ "slug": "agent-intelligence",
147
+ "title": "Agent Intelligence",
148
+ "category": "cross-cutting",
149
+ "path": "features/agent-intelligence.md",
150
+ "route": "cross-cutting",
151
+ "tags": ["ai", "routing", "loops", "swarm", "self-improvement", "ai-assist"],
152
+ "features": ["multi-agent-routing", "autonomous-loop-execution", "multi-agent-swarm", "agent-self-improvement", "workflow-context-batching", "ai-assist-workflow-creation"],
153
+ "screengrabCount": 2
154
+ },
155
+ {
156
+ "slug": "tool-permissions",
157
+ "title": "Tool Permissions",
158
+ "category": "cross-cutting",
159
+ "path": "features/tool-permissions.md",
160
+ "route": "cross-cutting",
161
+ "tags": ["permissions", "approvals", "presets", "governance", "trust-tiers"],
162
+ "features": ["tool-permission-persistence", "tool-permission-presets", "ambient-approval-toast"],
163
+ "screengrabCount": 1
164
+ },
165
+ {
166
+ "slug": "design-system",
167
+ "title": "Design System",
168
+ "category": "cross-cutting",
169
+ "path": "features/design-system.md",
170
+ "route": "cross-cutting",
171
+ "tags": ["design-system", "calm-ops", "tokens", "components", "visual-language"],
172
+ "features": ["calm-ops-design-system", "oklch-tokens", "elevation-system"],
173
+ "screengrabCount": 2
174
+ },
175
+ {
176
+ "slug": "keyboard-navigation",
177
+ "title": "Keyboard & Navigation",
178
+ "category": "cross-cutting",
179
+ "path": "features/keyboard-navigation.md",
180
+ "route": "cross-cutting",
181
+ "tags": ["keyboard", "navigation", "command-palette", "accessibility", "shortcuts"],
182
+ "features": ["command-palette", "keyboard-shortcuts", "focus-management"],
183
+ "screengrabCount": 1
184
+ },
185
+ {
186
+ "slug": "shared-components",
187
+ "title": "Shared Components",
188
+ "category": "cross-cutting",
189
+ "path": "features/shared-components.md",
190
+ "route": "cross-cutting",
191
+ "tags": ["components", "reusable", "page-shell", "detail-pane", "status-chip", "data-table"],
192
+ "features": ["page-shell", "detail-pane", "status-chip", "data-table", "empty-state", "error-state"],
193
+ "screengrabCount": 2
194
+ }
195
+ ],
196
+ "journeys": [
197
+ {
198
+ "slug": "personal-use",
199
+ "title": "Personal Use Guide",
200
+ "persona": "personal",
201
+ "difficulty": "beginner",
202
+ "path": "journeys/personal-use.md",
203
+ "sections": ["home-workspace", "chat", "dashboard-kanban", "projects", "playbook"],
204
+ "stepCount": 14
205
+ },
206
+ {
207
+ "slug": "work-use",
208
+ "title": "Work Use Guide",
209
+ "persona": "work",
210
+ "difficulty": "intermediate",
211
+ "path": "journeys/work-use.md",
212
+ "sections": ["projects", "chat", "documents", "workflows", "schedules", "cost-usage", "inbox-notifications"],
213
+ "stepCount": 15
214
+ },
215
+ {
216
+ "slug": "power-user",
217
+ "title": "Power User Guide",
218
+ "persona": "power-user",
219
+ "difficulty": "advanced",
220
+ "path": "journeys/power-user.md",
221
+ "sections": ["dashboard-kanban", "profiles", "chat", "workflows", "schedules", "monitoring"],
222
+ "stepCount": 15
223
+ },
224
+ {
225
+ "slug": "developer",
226
+ "title": "Developer Guide",
227
+ "persona": "developer",
228
+ "difficulty": "advanced",
229
+ "path": "journeys/developer.md",
230
+ "sections": ["settings", "environment", "chat", "monitoring", "profiles", "workflows", "schedules"],
231
+ "stepCount": 14
232
+ }
233
+ ],
234
+ "metadata": {
235
+ "totalDocs": 25,
236
+ "totalScreengrabs": 37,
237
+ "featuresCovered": 56,
238
+ "appSections": 13
239
+ }
240
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stagent",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Governed AI agent workspace for supervised local execution, workflows, documents, and provider runtimes.",
5
5
  "keywords": [
6
6
  "ai",
@@ -20,6 +20,7 @@
20
20
  },
21
21
  "files": [
22
22
  "dist/",
23
+ "docs/",
23
24
  "src/",
24
25
  "public/icon.svg",
25
26
  "public/icon-512.png",
@@ -6,6 +6,7 @@ import {
6
6
  } from "@/lib/environment/data";
7
7
  import { rollbackToCheckpoint, getCheckpointDiff } from "@/lib/environment/git-manager";
8
8
  import { restoreFromBackup } from "@/lib/environment/backup-manager";
9
+ import { getLaunchCwd } from "@/lib/environment/workspace-context";
9
10
 
10
11
  /** GET: Get checkpoint details with sync operations. */
11
12
  export async function GET(
@@ -24,7 +25,7 @@ export async function GET(
24
25
  // Get current diff if git checkpoint exists
25
26
  let diff: string | null = null;
26
27
  if (checkpoint.gitCommitSha) {
27
- diff = getCheckpointDiff(process.cwd(), checkpoint.gitCommitSha);
28
+ diff = getCheckpointDiff(getLaunchCwd(), checkpoint.gitCommitSha);
28
29
  }
29
30
 
30
31
  return NextResponse.json({ checkpoint, syncOps, diff });
@@ -53,7 +54,7 @@ export async function POST(
53
54
 
54
55
  // Rollback git changes if applicable
55
56
  if (checkpoint.gitCommitSha) {
56
- const projectDir = process.cwd();
57
+ const projectDir = getLaunchCwd();
57
58
  const gitResult = rollbackToCheckpoint(
58
59
  projectDir,
59
60
  checkpoint.gitCommitSha,
@@ -7,6 +7,7 @@ import { createGitCheckpoint, isGitRepo, getCurrentCommit } from "@/lib/environm
7
7
  import { backupFiles, backupDirectory } from "@/lib/environment/backup-manager";
8
8
  import { homedir } from "os";
9
9
  import { join } from "path";
10
+ import { getLaunchCwd } from "@/lib/environment/workspace-context";
10
11
 
11
12
  /** GET: List checkpoints, optionally filtered by projectId. */
12
13
  export async function GET(req: NextRequest) {
@@ -28,7 +29,7 @@ export async function POST(req: NextRequest) {
28
29
 
29
30
  const label = body.label || `Manual checkpoint ${new Date().toISOString()}`;
30
31
  const checkpointType = body.checkpointType || "manual";
31
- const projectDir = body.projectDir || process.cwd();
32
+ const projectDir = body.projectDir || getLaunchCwd();
32
33
 
33
34
  let gitTag: string | undefined;
34
35
  let gitCommitSha: string | undefined;
@@ -1,5 +1,6 @@
1
1
  import { NextRequest, NextResponse } from "next/server";
2
2
  import { scanEnvironment } from "@/lib/environment/scanner";
3
+ import { getLaunchCwd } from "@/lib/environment/workspace-context";
3
4
  import {
4
5
  createScan,
5
6
  getLatestScan,
@@ -11,7 +12,7 @@ import {
11
12
  /** POST: Trigger a new environment scan. */
12
13
  export async function POST(req: NextRequest) {
13
14
  const body = await req.json().catch(() => ({}));
14
- const projectDir = (body as { projectDir?: string }).projectDir || process.cwd();
15
+ const projectDir = (body as { projectDir?: string }).projectDir || getLaunchCwd();
15
16
  const projectId = (body as { projectId?: string }).projectId;
16
17
 
17
18
  const result = scanEnvironment({ projectDir });
@@ -17,6 +17,7 @@ import { resolveProfileRuntimePayload, type ResolvedProfileRuntimePayload } from
17
17
  import type { CanUseToolPolicy } from "./profiles/types";
18
18
  import { buildClaudeSdkEnv } from "./runtime/claude-sdk";
19
19
  import { getActiveLearnedContext } from "./learned-context";
20
+ import { getLaunchCwd } from "@/lib/environment/workspace-context";
20
21
  import { analyzeForLearnedPatterns } from "./pattern-extractor";
21
22
  import { processSweepResult } from "./sweep";
22
23
  import {
@@ -419,8 +420,8 @@ async function buildTaskQueryContext(
419
420
  .filter(Boolean)
420
421
  .join("\n\n");
421
422
 
422
- // Resolve working directory: project's workingDirectory > process.cwd()
423
- let cwd = process.cwd();
423
+ // Resolve working directory: project's workingDirectory > launch cwd
424
+ let cwd = getLaunchCwd();
424
425
  if (task.projectId) {
425
426
  const [project] = await db
426
427
  .select({ workingDirectory: projects.workingDirectory })
@@ -9,6 +9,7 @@ import { resolveProfileRuntimePayload } from "@/lib/agents/profiles/compatibilit
9
9
  import { executeClaudeTask, resumeClaudeTask } from "@/lib/agents/claude-agent";
10
10
  import { getRuntimeCapabilities, getRuntimeCatalogEntry } from "./catalog";
11
11
  import { buildClaudeSdkEnv } from "./claude-sdk";
12
+ import { getLaunchCwd } from "@/lib/environment/workspace-context";
12
13
  import type {
13
14
  AgentRuntimeAdapter,
14
15
  RuntimeConnectionResult,
@@ -272,7 +273,7 @@ export async function runMetaCompletion(input: {
272
273
  options: {
273
274
  abortController,
274
275
  includePartialMessages: true,
275
- cwd: process.cwd(),
276
+ cwd: getLaunchCwd(),
276
277
  env: buildClaudeSdkEnv(authEnv),
277
278
  allowedTools: [],
278
279
  maxTurns: 1,
@@ -343,7 +344,7 @@ async function runClaudeTaskAssist(
343
344
  options: {
344
345
  abortController,
345
346
  includePartialMessages: true,
346
- cwd: process.cwd(),
347
+ cwd: getLaunchCwd(),
347
348
  env: buildClaudeSdkEnv(authEnv),
348
349
  allowedTools: [], // No tool use — pure text completion
349
350
  maxTurns: 1, // Single turn only — no agentic loop
@@ -411,7 +412,7 @@ async function testClaudeConnection(): Promise<RuntimeConnectionResult> {
411
412
  abortController,
412
413
  maxTurns: 1,
413
414
  includePartialMessages: false,
414
- cwd: process.cwd(),
415
+ cwd: getLaunchCwd(),
415
416
  env: buildClaudeSdkEnv(authEnv),
416
417
  },
417
418
  });
@@ -20,6 +20,7 @@ import {
20
20
  } from "@/lib/settings/openai-auth";
21
21
  import { isToolAllowed } from "@/lib/settings/permissions";
22
22
  import { getRuntimeCatalogEntry } from "./catalog";
23
+ import { getLaunchCwd } from "@/lib/environment/workspace-context";
23
24
  import { CodexAppServerClient } from "./codex-app-server-client";
24
25
  import type {
25
26
  AgentRuntimeAdapter,
@@ -158,7 +159,7 @@ async function resolveTaskExecutionContext(
158
159
  .filter(Boolean)
159
160
  .join("\n\n");
160
161
 
161
- let cwd = process.cwd();
162
+ let cwd = getLaunchCwd();
162
163
  if (task.projectId) {
163
164
  const [project] = await db
164
165
  .select({ workingDirectory: projects.workingDirectory })
@@ -1013,7 +1014,7 @@ async function runOpenAITaskAssist(
1013
1014
  const result = await runAssistTurn({
1014
1015
  prompt,
1015
1016
  developerInstructions: TASK_ASSIST_SYSTEM_PROMPT,
1016
- cwd: process.cwd(),
1017
+ cwd: getLaunchCwd(),
1017
1018
  });
1018
1019
  usage = result.usage;
1019
1020
  const parsed = extractJsonObject(result.text);
@@ -1062,7 +1063,7 @@ async function testOpenAIConnection(): Promise<RuntimeConnectionResult> {
1062
1063
  let client: CodexAppServerClient | null = null;
1063
1064
  try {
1064
1065
  client = await CodexAppServerClient.connect({
1065
- cwd: process.cwd(),
1066
+ cwd: getLaunchCwd(),
1066
1067
  env: { OPENAI_API_KEY: apiKey },
1067
1068
  });
1068
1069
  await initializeOpenAIClient(client, apiKey);
@@ -35,6 +35,7 @@ import {
35
35
  type ToolPermissionResponse,
36
36
  } from "./permission-bridge";
37
37
  import { isToolAllowed } from "@/lib/settings/permissions";
38
+ import { getLaunchCwd } from "@/lib/environment/workspace-context";
38
39
  import { createStagentMcpServer } from "./stagent-tools";
39
40
 
40
41
  // ── Streaming input wrapper (required for MCP tools) ─────────────────
@@ -179,7 +180,7 @@ export async function* sendMessage(
179
180
  model: conversation.modelId || undefined,
180
181
  abortController,
181
182
  includePartialMessages: true,
182
- cwd: cwd ?? process.cwd(),
183
+ cwd: cwd ?? getLaunchCwd(),
183
184
  env: buildClaudeSdkEnv(authEnv),
184
185
  mcpServers: { stagent: stagentServer },
185
186
  allowedTools: ["mcp__stagent__*"],