thinkstack-core 4.0.0__py3-none-any.whl
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.
- thinkstack_core/__init__.py +158 -0
- thinkstack_core/aggphi_textual.py +275 -0
- thinkstack_core/alerts/__init__.py +23 -0
- thinkstack_core/alerts/base.py +46 -0
- thinkstack_core/alerts/config.py +60 -0
- thinkstack_core/alerts/dispatcher.py +110 -0
- thinkstack_core/alerts/jira.py +96 -0
- thinkstack_core/alerts/linear.py +72 -0
- thinkstack_core/alerts/pagerduty.py +66 -0
- thinkstack_core/alerts/slack.py +81 -0
- thinkstack_core/alerts/teams.py +70 -0
- thinkstack_core/audit/__init__.py +43 -0
- thinkstack_core/audit/exporter.py +297 -0
- thinkstack_core/audit/privacy.py +101 -0
- thinkstack_core/audit/scrubber.py +149 -0
- thinkstack_core/audit/service.py +67 -0
- thinkstack_core/audit/signing.py +127 -0
- thinkstack_core/broadcast/__init__.py +4 -0
- thinkstack_core/broadcast/broadcaster.py +100 -0
- thinkstack_core/broadcast/watcher.py +71 -0
- thinkstack_core/capability.py +639 -0
- thinkstack_core/cloud/__init__.py +1 -0
- thinkstack_core/cloud/client_config.py +472 -0
- thinkstack_core/cloud/client_configs/.claude-opencode-fallback.json +8 -0
- thinkstack_core/cloud/client_configs/.claude-stdio.json +13 -0
- thinkstack_core/cloud/client_configs/.cursor-mcp.json +13 -0
- thinkstack_core/cloud/client_configs/.opencode-bridge.json +13 -0
- thinkstack_core/cloud/client_configs/.opencode.json +15 -0
- thinkstack_core/cloud/client_configs/.vscode-mcp.json +13 -0
- thinkstack_core/cloud/mcp_client.py +229 -0
- thinkstack_core/cloud/setup.py +144 -0
- thinkstack_core/cloud/sync.py +143 -0
- thinkstack_core/cloud/sync_bundle.py +639 -0
- thinkstack_core/cloud/sync_conflicts.py +183 -0
- thinkstack_core/cloud/sync_state.py +159 -0
- thinkstack_core/cloud/team_sync.py +337 -0
- thinkstack_core/cloud/thinkstack-mcp-bridge.js +357 -0
- thinkstack_core/codex/__init__.py +9 -0
- thinkstack_core/codex/__main__.py +97 -0
- thinkstack_core/codex/capture.py +208 -0
- thinkstack_core/codex/proxy.py +412 -0
- thinkstack_core/compat.py +103 -0
- thinkstack_core/concept_catalog.py +209 -0
- thinkstack_core/consolidation/__init__.py +3 -0
- thinkstack_core/consolidation/synthesizer.py +87 -0
- thinkstack_core/consolidation/workflow.py +175 -0
- thinkstack_core/daemon/__init__.py +27 -0
- thinkstack_core/daemon/supervisor.py +293 -0
- thinkstack_core/daemon/watcher.py +244 -0
- thinkstack_core/dashboard_api.py +2012 -0
- thinkstack_core/deltaf.py +97 -0
- thinkstack_core/disclosure.py +50 -0
- thinkstack_core/divergence/__init__.py +3 -0
- thinkstack_core/divergence/detector.py +166 -0
- thinkstack_core/gateway/__init__.py +32 -0
- thinkstack_core/gateway/key_manager.py +124 -0
- thinkstack_core/gateway/metrics_webhook.py +252 -0
- thinkstack_core/gateway/policy.py +262 -0
- thinkstack_core/gateway/server.py +727 -0
- thinkstack_core/gateway/sso.py +233 -0
- thinkstack_core/gcc.py +1246 -0
- thinkstack_core/github/__init__.py +35 -0
- thinkstack_core/github/app.py +240 -0
- thinkstack_core/github/comment_builder.py +113 -0
- thinkstack_core/github/pat.py +76 -0
- thinkstack_core/github/pr_parser.py +82 -0
- thinkstack_core/github/pr_reporter.py +555 -0
- thinkstack_core/gitlab/__init__.py +177 -0
- thinkstack_core/hitl/__init__.py +4 -0
- thinkstack_core/hitl/channels.py +129 -0
- thinkstack_core/hitl/orchestrator.py +95 -0
- thinkstack_core/hooks/__init__.py +17 -0
- thinkstack_core/hooks/claude_code.py +228 -0
- thinkstack_core/hooks/git_capture.py +341 -0
- thinkstack_core/hooks/git_commit.py +182 -0
- thinkstack_core/hooks/installer.py +850 -0
- thinkstack_core/hooks/pre_commit.py +157 -0
- thinkstack_core/hooks/runner.py +386 -0
- thinkstack_core/identity/__init__.py +4 -0
- thinkstack_core/identity/agent.py +86 -0
- thinkstack_core/identity/providers.py +85 -0
- thinkstack_core/invariants.py +182 -0
- thinkstack_core/mcp/__init__.py +10 -0
- thinkstack_core/mcp/auth.py +177 -0
- thinkstack_core/mcp/server.py +1215 -0
- thinkstack_core/metrics/__init__.py +35 -0
- thinkstack_core/metrics/aggregate.py +215 -0
- thinkstack_core/metrics/calibrate.py +198 -0
- thinkstack_core/metrics/calibration.py +125 -0
- thinkstack_core/metrics/credibility.py +288 -0
- thinkstack_core/metrics/delivery_time.py +70 -0
- thinkstack_core/metrics/dhs.py +126 -0
- thinkstack_core/metrics/mcs.py +96 -0
- thinkstack_core/metrics/roi.py +88 -0
- thinkstack_core/metrics/session_writer.py +81 -0
- thinkstack_core/metrics/shadow_ai.py +117 -0
- thinkstack_core/metrics/sprint_writer.py +243 -0
- thinkstack_core/observability/__init__.py +78 -0
- thinkstack_core/observability/datadog.py +157 -0
- thinkstack_core/observability/formatter.py +119 -0
- thinkstack_core/observability/report.py +264 -0
- thinkstack_core/observability/servicenow.py +147 -0
- thinkstack_core/observability/splunk.py +218 -0
- thinkstack_core/observability/webhook.py +227 -0
- thinkstack_core/parser/__init__.py +30 -0
- thinkstack_core/parser/blocks.py +216 -0
- thinkstack_core/parser/inference.py +159 -0
- thinkstack_core/parser/thinking.py +112 -0
- thinkstack_core/projects.py +169 -0
- thinkstack_core/prompt_artifact.py +76 -0
- thinkstack_core/proxy/__init__.py +9 -0
- thinkstack_core/proxy/routes/__init__.py +1 -0
- thinkstack_core/proxy/routes/anthropic.py +264 -0
- thinkstack_core/proxy/routes/azure_openai.py +336 -0
- thinkstack_core/proxy/routes/gemini.py +331 -0
- thinkstack_core/proxy/routes/groq.py +284 -0
- thinkstack_core/proxy/routes/ollama.py +279 -0
- thinkstack_core/proxy/routes/openai.py +287 -0
- thinkstack_core/proxy/server.py +356 -0
- thinkstack_core/query/__init__.py +15 -0
- thinkstack_core/query/grep.py +181 -0
- thinkstack_core/query/hybrid.py +86 -0
- thinkstack_core/query/semantic.py +157 -0
- thinkstack_core/rdp.py +105 -0
- thinkstack_core/reasoning/__init__.py +4 -0
- thinkstack_core/reasoning/entry.py +31 -0
- thinkstack_core/reasoning/store.py +122 -0
- thinkstack_core/reasoning_plus/__init__.py +70 -0
- thinkstack_core/reasoning_plus/augmenter.py +337 -0
- thinkstack_core/reasoning_plus/capture.py +51 -0
- thinkstack_core/reasoning_plus/config.py +313 -0
- thinkstack_core/reasoning_plus/context.py +262 -0
- thinkstack_core/reasoning_plus/learning/__init__.py +125 -0
- thinkstack_core/reasoning_plus/learning/analytics.py +141 -0
- thinkstack_core/reasoning_plus/learning/api.py +784 -0
- thinkstack_core/reasoning_plus/learning/chain.py +285 -0
- thinkstack_core/reasoning_plus/learning/composer.py +141 -0
- thinkstack_core/reasoning_plus/learning/conflicts.py +184 -0
- thinkstack_core/reasoning_plus/learning/context_collector.py +194 -0
- thinkstack_core/reasoning_plus/learning/cross_project.py +234 -0
- thinkstack_core/reasoning_plus/learning/deny_list.py +108 -0
- thinkstack_core/reasoning_plus/learning/embeddings.py +209 -0
- thinkstack_core/reasoning_plus/learning/evolution.py +119 -0
- thinkstack_core/reasoning_plus/learning/extractor.py +271 -0
- thinkstack_core/reasoning_plus/learning/filter_five_layer.py +95 -0
- thinkstack_core/reasoning_plus/learning/models.py +149 -0
- thinkstack_core/reasoning_plus/learning/org_store.py +156 -0
- thinkstack_core/reasoning_plus/learning/pii.py +142 -0
- thinkstack_core/reasoning_plus/learning/promotion.py +58 -0
- thinkstack_core/reasoning_plus/learning/provenance.py +126 -0
- thinkstack_core/reasoning_plus/learning/recorder.py +81 -0
- thinkstack_core/reasoning_plus/learning/relevance.py +122 -0
- thinkstack_core/reasoning_plus/learning/state.py +86 -0
- thinkstack_core/reasoning_plus/learning/store.py +178 -0
- thinkstack_core/reasoning_plus/learning/theta_learning_bridge.py +94 -0
- thinkstack_core/reasoning_plus/prompt.py +90 -0
- thinkstack_core/rep.py +134 -0
- thinkstack_core/rep_network/__init__.py +25 -0
- thinkstack_core/rep_network/merge.py +70 -0
- thinkstack_core/rep_network/node.py +137 -0
- thinkstack_core/rep_network/server.py +140 -0
- thinkstack_core/rep_network/sync.py +207 -0
- thinkstack_core/sensitivity.py +182 -0
- thinkstack_core/serve.py +258 -0
- thinkstack_core/session/__init__.py +39 -0
- thinkstack_core/session/disagreement.py +188 -0
- thinkstack_core/session/models.py +114 -0
- thinkstack_core/session/orchestrator.py +182 -0
- thinkstack_core/session/planner.py +169 -0
- thinkstack_core/session/simulator.py +132 -0
- thinkstack_core/signing.py +290 -0
- thinkstack_core/sis.py +197 -0
- thinkstack_core/skills/pr-reviewer/SKILL.md +204 -0
- thinkstack_core/skills/thinkstack-auto-sync/SKILL.md +175 -0
- thinkstack_core/skills/thinkstack-session-start/SKILL.md +136 -0
- thinkstack_core/storage.py +308 -0
- thinkstack_core/templates/__init__.py +6 -0
- thinkstack_core/templates/engine.py +122 -0
- thinkstack_core/templates/go.py +18 -0
- thinkstack_core/templates/infra.py +19 -0
- thinkstack_core/templates/library/__init__.py +18 -0
- thinkstack_core/templates/library/api_design.md +27 -0
- thinkstack_core/templates/library/bug_fix.md +27 -0
- thinkstack_core/templates/library/decision_record.md +27 -0
- thinkstack_core/templates/library/engine.py +228 -0
- thinkstack_core/templates/library/security_review.md +30 -0
- thinkstack_core/templates/python.py +19 -0
- thinkstack_core/templates/react.py +18 -0
- thinkstack_core/templates/typescript.py +18 -0
- thinkstack_core/theta.py +221 -0
- thinkstack_core/theta_synthesis.py +268 -0
- thinkstack_core/topics.py +320 -0
- thinkstack_core/variance.py +219 -0
- thinkstack_core/wrapper/__init__.py +52 -0
- thinkstack_core/wrapper/anthropic.py +487 -0
- thinkstack_core/wrapper/base.py +562 -0
- thinkstack_core/wrapper/bedrock.py +342 -0
- thinkstack_core/wrapper/gemini.py +422 -0
- thinkstack_core/wrapper/ollama.py +527 -0
- thinkstack_core/wrapper/openai.py +461 -0
- thinkstack_core-4.0.0.dist-info/METADATA +868 -0
- thinkstack_core-4.0.0.dist-info/RECORD +205 -0
- thinkstack_core-4.0.0.dist-info/WHEEL +5 -0
- thinkstack_core-4.0.0.dist-info/entry_points.txt +2 -0
- thinkstack_core-4.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-reviewer
|
|
3
|
+
description: Use when the user writes "Review PR" (or "review PR", "code review", "review pull request", "review https://github.com/.../pull/") followed by a GitHub PR link — performs an expert code review, accepts/merges if standards are met, or rejects with detailed comments
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PR Reviewer
|
|
7
|
+
|
|
8
|
+
## Trigger
|
|
9
|
+
|
|
10
|
+
This skill loads when the user prompts with any of:
|
|
11
|
+
- "Review PR"
|
|
12
|
+
- "review PR"
|
|
13
|
+
- "review pull request"
|
|
14
|
+
- "code review"
|
|
15
|
+
- "review https://github.com/.../pull/..."
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
Performs a thorough expert-level code review on a GitHub pull request. The review evaluates code quality, security, correctness, API stability, backward compatibility, test coverage, and CI/CD health. Based on the findings, the PR is either accepted and merged, or rejected with detailed comments explaining what needs to be fixed.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
### Step 0: Select Model
|
|
24
|
+
|
|
25
|
+
Before starting the review, run `opencode models` to list available models:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
opencode models
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Parse the output to find the preferred model:
|
|
32
|
+
- **Preferred**: `fireworks-ai/accounts/fireworks/models/glm-5p2` — check if this ID appears in the model list
|
|
33
|
+
- **Fallback**: `fireworks-ai/accounts/fireworks/models/deepseek-v4-pro` — use if GLM 5.2 is not available
|
|
34
|
+
|
|
35
|
+
If neither model is listed, prompt the user with the available Fireworks models and ask which to use. If the user doesn't respond, default to the first listed `fireworks-ai` model.
|
|
36
|
+
|
|
37
|
+
This ensures the review uses the best available model for code analysis without relying on any external gateway.
|
|
38
|
+
|
|
39
|
+
### Step 1: Identify the PR URL
|
|
40
|
+
|
|
41
|
+
Extract the full GitHub PR URL from the user's prompt. Validate it matches `https://github.com/*/*/pull/*`.
|
|
42
|
+
|
|
43
|
+
If no PR URL is found, ask the user to provide one before proceeding.
|
|
44
|
+
|
|
45
|
+
### Step 2: Fetch PR Metadata
|
|
46
|
+
|
|
47
|
+
Use `gh pr view <pr-number> --json number,title,state,baseRefName,headRefName,additions,deletions,changedFiles,commits,mergeable,mergeStateStatus,statusCheckRollup,reviews,comments` to get:
|
|
48
|
+
|
|
49
|
+
- PR title and description
|
|
50
|
+
- Base and head branches
|
|
51
|
+
- File change statistics
|
|
52
|
+
- Commit history
|
|
53
|
+
- Merge status (mergeable, mergeStateStatus)
|
|
54
|
+
- CI status (statusCheckRollup — check conclusion for each check run)
|
|
55
|
+
- Existing reviews and comments
|
|
56
|
+
|
|
57
|
+
### Step 3: Fetch the Full Diff
|
|
58
|
+
|
|
59
|
+
Use `gh pr diff <pr-number>` to get the complete diff. This is essential — the diff is the primary artifact for code review.
|
|
60
|
+
|
|
61
|
+
### Step 4: Identify the Repository Root
|
|
62
|
+
|
|
63
|
+
Look at the `repo` field or the PR URL to determine the repository's local path. If the repo is not cloned locally, clone it first or skip local checks.
|
|
64
|
+
|
|
65
|
+
### Step 5: Review Categories
|
|
66
|
+
|
|
67
|
+
Evaluate the PR across these dimensions, in order:
|
|
68
|
+
|
|
69
|
+
#### 5a. CI/CD Health (BLOCKING)
|
|
70
|
+
|
|
71
|
+
Check `statusCheckRollup` from the PR metadata. If ANY check run has `conclusion: "FAILURE"`, investigate the failure:
|
|
72
|
+
- If the failure is caused by the PR's code changes → **blocking issue**
|
|
73
|
+
- If the failure is a pre-existing infrastructure issue (e.g., missing API keys, workflow misconfiguration, unrelated to this PR's changes) → note but do not block
|
|
74
|
+
|
|
75
|
+
Check `mergeStateStatus`:
|
|
76
|
+
- `"CLEAN"` = good
|
|
77
|
+
- `"UNSTABLE"` = CI issues (investigate)
|
|
78
|
+
- `"DIRTY"` = merge conflict (blocking)
|
|
79
|
+
- `"BEHIND"` = branch needs rebase (blocking)
|
|
80
|
+
|
|
81
|
+
#### 5b. Security (BLOCKING)
|
|
82
|
+
|
|
83
|
+
Look for:
|
|
84
|
+
- Secrets, API keys, tokens, or credentials in the diff
|
|
85
|
+
- SQL injection, command injection, or template injection vulnerabilities
|
|
86
|
+
- Authentication/authorization gaps
|
|
87
|
+
- PII handling (logging sensitive data, inadequate redaction)
|
|
88
|
+
- Unsafe deserialization or eval() usage
|
|
89
|
+
- Hardcoded credentials or URLs with embedded tokens
|
|
90
|
+
- Insecure defaults (e.g., `debug=True` in production)
|
|
91
|
+
|
|
92
|
+
If security issues are found → **REJECT** with explicit vulnerability description, severity, and exact file/line references.
|
|
93
|
+
|
|
94
|
+
#### 5c. Correctness (BLOCKING)
|
|
95
|
+
|
|
96
|
+
Look for:
|
|
97
|
+
- Bugs: null pointer, off-by-one, race conditions, logic errors
|
|
98
|
+
- Incorrect error handling: bare excepts, swallowed exceptions, missing cleanup
|
|
99
|
+
- Broken invariants: assumptions that don't hold
|
|
100
|
+
- Incorrect indices, boundary conditions
|
|
101
|
+
- API contract violations (wrong HTTP methods, status codes, response shapes)
|
|
102
|
+
- Database schema issues (missing indexes, nullable issues, migration safety)
|
|
103
|
+
|
|
104
|
+
If correctness bugs are found → **REJECT** with exact reproduction scenarios.
|
|
105
|
+
|
|
106
|
+
#### 5d. Backward Compatibility (BLOCKING)
|
|
107
|
+
|
|
108
|
+
Look for:
|
|
109
|
+
- Breaking changes to public APIs, MCP tool schemas, or CLI interfaces
|
|
110
|
+
- Changes to data formats on disk (`.GCC/` schemas) without migration path
|
|
111
|
+
- Removal of deprecated functions without documented replacement
|
|
112
|
+
- Changes to configuration keys or default behaviors
|
|
113
|
+
- Changes that require user intervention to upgrade
|
|
114
|
+
|
|
115
|
+
If breaking changes are found without a migration plan or documented justification → **REJECT**.
|
|
116
|
+
|
|
117
|
+
#### 5e. Test Coverage (HIGH PRIORITY)
|
|
118
|
+
|
|
119
|
+
Look for:
|
|
120
|
+
- New code without corresponding tests
|
|
121
|
+
- Tests that don't actually test the behavior described
|
|
122
|
+
- Fragile tests (hardcoded paths, timing-dependent, environment-specific)
|
|
123
|
+
- Missing edge case coverage
|
|
124
|
+
|
|
125
|
+
If new features are added without adequate tests → **REJECT**.
|
|
126
|
+
|
|
127
|
+
#### 5f. Code Quality
|
|
128
|
+
|
|
129
|
+
Look for:
|
|
130
|
+
- Dead code, commented-out code, or unused imports
|
|
131
|
+
- Inconsistent naming or formatting with the project's conventions
|
|
132
|
+
- Duplicated code that should be factored out
|
|
133
|
+
- Overly complex functions (too many arguments, too many responsibilities)
|
|
134
|
+
- Missing or misleading docstrings
|
|
135
|
+
- Incorrect type annotations
|
|
136
|
+
- Incorrect use of libraries or frameworks
|
|
137
|
+
- Conflicting patterns or versions of frameworks being introduced
|
|
138
|
+
- Hardcoded values that should be configuration
|
|
139
|
+
|
|
140
|
+
#### 5g. Architecture & Design
|
|
141
|
+
|
|
142
|
+
Look for:
|
|
143
|
+
- Violations of project layering (e.g., core library depending on CLI)
|
|
144
|
+
- Mixing concerns in a single module
|
|
145
|
+
- Inappropriate coupling between modules
|
|
146
|
+
- Changes that don't fit the project's design philosophy
|
|
147
|
+
|
|
148
|
+
### Step 6: Running Tests (REQUIRED for new features)
|
|
149
|
+
|
|
150
|
+
If the PR adds new code, attempt to run the relevant tests locally:
|
|
151
|
+
```bash
|
|
152
|
+
python -m pytest <relevant test files> -v --tb=short
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
If any tests fail (other than pre-existing failures), this is a blocking issue.
|
|
156
|
+
|
|
157
|
+
### Step 7: Decision
|
|
158
|
+
|
|
159
|
+
**ACCEPT** if:
|
|
160
|
+
- ALL blocking categories (CI, Security, Correctness, Backward Compatibility, Test Coverage) pass with no issues
|
|
161
|
+
- Code quality and architecture are acceptable
|
|
162
|
+
- Tests pass (new and existing)
|
|
163
|
+
|
|
164
|
+
**REJECT** if:
|
|
165
|
+
- ANY blocking issue is found
|
|
166
|
+
- The issue is severe enough to warrant rejection
|
|
167
|
+
|
|
168
|
+
### Step 8: Post Decision
|
|
169
|
+
|
|
170
|
+
If **ACCEPTED**:
|
|
171
|
+
1. Post a detailed review comment summarizing findings, what was checked, and the verdict
|
|
172
|
+
2. Merge the PR using `gh pr merge <pr-number> --squash --subject "<good commit subject>" --body "<detailed commit body>"`
|
|
173
|
+
|
|
174
|
+
If **REJECTED**:
|
|
175
|
+
1. POST a comprehensive review comment (via `gh pr comment <pr-number>`) with:
|
|
176
|
+
- Clear verdict: **Rejected: [reason]**
|
|
177
|
+
- Numbered list of each blocking issue with exact file:line
|
|
178
|
+
- For each issue: what's wrong, why it matters, and how to fix it
|
|
179
|
+
- Non-blocking issues as a separate section
|
|
180
|
+
- What's good about the PR (specific compliments)
|
|
181
|
+
- Do NOT merge the PR
|
|
182
|
+
|
|
183
|
+
## Model Selection
|
|
184
|
+
|
|
185
|
+
This agent selects its model by running `opencode models` at the start of the session and parsing the output:
|
|
186
|
+
|
|
187
|
+
1. **Preferred**: `fireworks-ai/accounts/fireworks/models/glm-5p2` — GLM 5.2 from Fireworks AI
|
|
188
|
+
2. **Fallback**: `fireworks-ai/accounts/fireworks/models/deepseek-v4-pro` — DeepSeek V4 Pro (if GLM 5.2 is not listed)
|
|
189
|
+
|
|
190
|
+
The agent must dynamically choose based on what models are available. If neither is found, prompt the user suggesting one of the listed Fireworks models.
|
|
191
|
+
|
|
192
|
+
Model requirements:
|
|
193
|
+
- Context window: at least 128K tokens (PR diffs can be large)
|
|
194
|
+
- Temperature: 0.1 (low temperature for consistent, deterministic reviews)
|
|
195
|
+
- Tool call support: required (for gh CLI)
|
|
196
|
+
|
|
197
|
+
## Key Commands
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
gh pr view <number> --repo <owner/repo> --json <fields> # Get PR metadata
|
|
201
|
+
gh pr diff <number> --repo <owner/repo> # Get full diff
|
|
202
|
+
gh pr comment <number> --repo <owner/repo> --body-file <f> # Post review comment
|
|
203
|
+
gh pr merge <number> --repo <owner/repo> --squash <args> # Merge PR (accept only)
|
|
204
|
+
```
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thinkstack-auto-sync
|
|
3
|
+
description: Use during an active opencode or Claude Code session to periodically sync learnings and reasoning with the ThinkStack MCP server. Also automatically invoked when a session ends/exits/quits — commits remaining reasoning, pushes learnings to org store, pulls new learnings, and logs the sync summary. Configurable interval (default 5 minutes). Triggers on "thinkstack sync", "thinkstack auto sync", "sync thinkstack", "session ends", "session exits", "session quits", "opencode exits", "claude code exits", "ide closed", or periodically via hook.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ThinkStack Auto Sync
|
|
7
|
+
|
|
8
|
+
## Trigger
|
|
9
|
+
|
|
10
|
+
This skill loads when the user writes any of:
|
|
11
|
+
- "thinkstack sync"
|
|
12
|
+
- "thinkstack auto sync"
|
|
13
|
+
- "sync thinkstack"
|
|
14
|
+
- "thinkstack sync now"
|
|
15
|
+
- "thinkstack sync start"
|
|
16
|
+
- "start thinkstack auto sync"
|
|
17
|
+
|
|
18
|
+
It is also wired into the Claude Code `PostToolUse` hook to auto-capture after every mutating tool call, and the `Stop` hook to perform a final sync on session end.
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
Keeps the ThinkStack MCP server in sync with the local `.GCC/` store. Automatically:
|
|
23
|
+
1. Commits any unreasoned changes with a reasoning message
|
|
24
|
+
2. Records sensitivity signals for security-relevant operations
|
|
25
|
+
3. Pushes learnings and context to the org-level MCP store
|
|
26
|
+
4. Checks for sync conflicts post-push
|
|
27
|
+
|
|
28
|
+
Runs on a **configurable interval** (default: every 5 minutes) or on-demand.
|
|
29
|
+
|
|
30
|
+
## Configuration
|
|
31
|
+
|
|
32
|
+
The sync interval is controlled by the ThinkStack config:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
// .GCC/settings.json
|
|
36
|
+
{
|
|
37
|
+
"reasoning_plus": {
|
|
38
|
+
"auto_sync_enabled": true,
|
|
39
|
+
"auto_sync_interval_secs": 300,
|
|
40
|
+
"auto_sync_on_tool_use": true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Set via CLI:
|
|
46
|
+
```bash
|
|
47
|
+
thinkstack reasoning-plus config --auto-sync-interval-secs 300
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Workflow
|
|
51
|
+
|
|
52
|
+
### Interval-Based Periodic Sync
|
|
53
|
+
|
|
54
|
+
When running in interval mode (every N minutes):
|
|
55
|
+
|
|
56
|
+
#### Step 1: Commit Reasoning
|
|
57
|
+
|
|
58
|
+
Before the first tool use since the last sync interval:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
MCP Tool: thinkstack_commit
|
|
62
|
+
Args: {
|
|
63
|
+
"message": "<what was decided and WHY since last sync>",
|
|
64
|
+
"branch": "<current branch>"
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The commit message must explain the *why*, not the *what*.
|
|
69
|
+
|
|
70
|
+
#### Step 2: Record Sensitivities
|
|
71
|
+
|
|
72
|
+
For any security-relevant concepts touched since last sync:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
MCP Tool: thinkstack_sensitivity_add
|
|
76
|
+
Args: {
|
|
77
|
+
"concept": "auth|schema|payments|secrets|pii|api|security|config",
|
|
78
|
+
"signal": "<reasoning text>",
|
|
79
|
+
"confidence": 0.0-1.0,
|
|
80
|
+
"disclosure": "PUBLIC|PROTECTED|PRIVATE"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Step 3: Push Learnings
|
|
85
|
+
|
|
86
|
+
Push local learnings to the org store:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
MCP Tool: thinkstack_sync_push
|
|
90
|
+
Args: {
|
|
91
|
+
"bundle": "<gzip-compressed, base64-encoded sync bundle>"
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This is constructed from the local delta (what changed since last sync).
|
|
96
|
+
|
|
97
|
+
#### Step 4: Check for Conflicts
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Read .GCC/sync_conflicts.jsonl
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Report any new conflicts since the last check. If conflicts are found, escalate to the user.
|
|
104
|
+
|
|
105
|
+
### Post-Tool-Use Auto Capture
|
|
106
|
+
|
|
107
|
+
After every mutating tool call (Write, Edit, Bash), the existing `PostToolUse` hook automatically:
|
|
108
|
+
1. Records a reasoning call via `thinkstack_commit` or the capture orchestrator
|
|
109
|
+
2. Extracts learnings from the reasoning
|
|
110
|
+
3. Pushes learnings to the MCP server
|
|
111
|
+
|
|
112
|
+
This is already configured in the Claude Code hooks installer.
|
|
113
|
+
|
|
114
|
+
### Session-End Final Sync
|
|
115
|
+
|
|
116
|
+
When the session ends (`Stop` hook or `thinkstack auto sync stop`):
|
|
117
|
+
|
|
118
|
+
1. **Final commit**: Record all remaining unreasoned decisions
|
|
119
|
+
2. **Final push**: Push all learnings to the org store
|
|
120
|
+
3. **Sync pull**: Pull any new learnings from the org store that other agents may have contributed
|
|
121
|
+
4. **Conflict check**: Report any unresolved sync conflicts
|
|
122
|
+
5. **Print summary**:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
════ ThinkStack Sync Summary ════
|
|
126
|
+
|
|
127
|
+
Session duration: <X> minutes
|
|
128
|
+
Commits pushed: <N>
|
|
129
|
+
Learnings extracted: <M>
|
|
130
|
+
Sensitivities recorded: <P>
|
|
131
|
+
Sync conflicts: <Q> (0 unresolved)
|
|
132
|
+
|
|
133
|
+
All learnings synced to org store.
|
|
134
|
+
══════════════════════════════
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Periodic Sync Daemon
|
|
138
|
+
|
|
139
|
+
For continuous background syncing every N minutes, use the ThinkStack daemon:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Start daemon with auto-sync
|
|
143
|
+
thinkstack daemon start --auto-sync --interval 300
|
|
144
|
+
|
|
145
|
+
# Check status
|
|
146
|
+
thinkstack daemon status
|
|
147
|
+
|
|
148
|
+
# View logs
|
|
149
|
+
thinkstack daemon logs
|
|
150
|
+
|
|
151
|
+
# Stop daemon
|
|
152
|
+
thinkstack daemon stop
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The daemon watches filesystem changes, automatically commits reasoning events, and pushes sync bundles every `--interval` seconds. It runs as a background process that survives the IDE session.
|
|
156
|
+
|
|
157
|
+
## Manual Sync (On-Demand)
|
|
158
|
+
|
|
159
|
+
To manually trigger a full sync at any time:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
thinkstack sync all
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
This performs a bidirectional sync: push local changes, pull remote changes, merge with conflict resolution.
|
|
166
|
+
|
|
167
|
+
## MCP Tools Used
|
|
168
|
+
|
|
169
|
+
| Tool | Purpose |
|
|
170
|
+
|---|---|
|
|
171
|
+
| `thinkstack_commit` | Record reasoning decisions |
|
|
172
|
+
| `thinkstack_sensitivity_add` | Record sensitivity signals |
|
|
173
|
+
| `thinkstack_sync_push` | Push learnings to org store |
|
|
174
|
+
| `thinkstack_sync_pull` | Pull learnings from org store |
|
|
175
|
+
| `thinkstack_sync_status` | Check sync state |
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thinkstack-session-start
|
|
3
|
+
description: Use when an opencode or Claude Code session starts — connects to ThinkStack MCP, runs connectivity checks, loads learnings from previous work, commits, and code reviews to bootstrap the current session with full context
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ThinkStack Session Start
|
|
7
|
+
|
|
8
|
+
## Trigger
|
|
9
|
+
|
|
10
|
+
This skill loads when the user:
|
|
11
|
+
- Starts a new opencode session
|
|
12
|
+
- Starts a new Claude Code session
|
|
13
|
+
- Says "thinkstack session start", "thinkstack load context", "load previous learnings"
|
|
14
|
+
- Any first prompt in a freshly started IDE
|
|
15
|
+
|
|
16
|
+
It is also wired into the Claude Code `UserPromptSubmit` hook and opencode's PreUserPrompt hook to auto-fire on session initialization.
|
|
17
|
+
|
|
18
|
+
## Overview
|
|
19
|
+
|
|
20
|
+
Connects to the ThinkStack MCP server for the current project, verifies connectivity, reads recent context (commits, learnings, conflicts, theta), and presents a session bootstrap summary. This ensures every coding session starts with full awareness of prior decisions, risks, and collective learnings.
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
### Step 1: Connectivity Check
|
|
25
|
+
|
|
26
|
+
Run the ThinkStack MCP connectivity test to confirm the project is connected:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
thinkstack doctor
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If `thinkstack doctor` fails with an error, report the issue and fall back to local-only mode. Read from `.GCC/` directly as a fallback.
|
|
33
|
+
|
|
34
|
+
If successful, confirm: "ThinkStack MCP connected. Loading session context..."
|
|
35
|
+
|
|
36
|
+
### Step 2: Load Prior Context
|
|
37
|
+
|
|
38
|
+
Call the `thinkstack_context` MCP tool with a token budget of 8000:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
MCP Tool: thinkstack_context
|
|
42
|
+
Args: { "k": 8000 }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This retrieves a bounded context bundle with:
|
|
46
|
+
- Current reasoning roadmap (main.md)
|
|
47
|
+
- Recent reasoning log (log.md)
|
|
48
|
+
- Coordination vector Θ (theta.json)
|
|
49
|
+
- Recent commits
|
|
50
|
+
|
|
51
|
+
### Step 3: Load Previous Learnings
|
|
52
|
+
|
|
53
|
+
Call the `thinkstack_reasoning_plus_learning_query` MCP tool:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
MCP Tool: thinkstack_reasoning_plus_learning_query
|
|
57
|
+
Args: { "context": "<project name or repo name>", "top_n": 5 }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This returns the top 5 most relevant learnings from previous sessions, ranked by relevance to the current project.
|
|
61
|
+
|
|
62
|
+
If the MCP tool is unavailable, fall back to reading from `.GCC/reasoning_learnings/learnings/` directly.
|
|
63
|
+
|
|
64
|
+
### Step 4: Check Sync Status
|
|
65
|
+
|
|
66
|
+
Call the `thinkstack_sync_status` MCP tool:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
MCP Tool: thinkstack_sync_status
|
|
70
|
+
Args: {}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Reports:
|
|
74
|
+
- Number of commits on the server
|
|
75
|
+
- Number of learnings stored
|
|
76
|
+
- Number of theta concepts tracked
|
|
77
|
+
|
|
78
|
+
### Step 5: Check for Unresolved Conflicts
|
|
79
|
+
|
|
80
|
+
Read from `.GCC/sync_conflicts.jsonl` or call list_conflicts to get unresolved conflicts from previous sync operations.
|
|
81
|
+
|
|
82
|
+
Report any unresolved conflicts that need human attention.
|
|
83
|
+
|
|
84
|
+
### Step 6: Load Code Review Learnings
|
|
85
|
+
|
|
86
|
+
Search for learnings related to code review patterns:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
MCP Tool: thinkstack_learning_search
|
|
90
|
+
Args: { "query": "code review pattern security quality", "top_n": 3 }
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This surfaces learnings from previous PR reviews about patterns to watch for, security pitfalls, or quality standards.
|
|
94
|
+
|
|
95
|
+
### Step 7: Present Bootstrap Summary
|
|
96
|
+
|
|
97
|
+
Print a concise session bootstrap summary:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
════ ThinkStack Session Bootstrap ════
|
|
101
|
+
|
|
102
|
+
MCP Connection: ✅ connected
|
|
103
|
+
Project: <name>
|
|
104
|
+
Branch: <current git branch>
|
|
105
|
+
|
|
106
|
+
Prior Context:
|
|
107
|
+
• <number> recent commits loaded
|
|
108
|
+
• Coordination vector: <number> concepts tracked
|
|
109
|
+
|
|
110
|
+
Learnings (from previous sessions):
|
|
111
|
+
1. [<confidence>] <learning content>
|
|
112
|
+
2. [<confidence>] <learning content>
|
|
113
|
+
...
|
|
114
|
+
|
|
115
|
+
Code Review Insights:
|
|
116
|
+
• <key pattern to follow>
|
|
117
|
+
|
|
118
|
+
Sync Status:
|
|
119
|
+
Commits: <count> | Learnings: <count> | Theta: <count>
|
|
120
|
+
|
|
121
|
+
⚠ <number> unresolved sync conflict(s) — run thinkstack sync conflicts
|
|
122
|
+
|
|
123
|
+
Ready to work. All prior context loaded.
|
|
124
|
+
═══════════════════════════════════════
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Fallback
|
|
128
|
+
|
|
129
|
+
If MCP tools are unreachable, fall back to local `.GCC/` reads:
|
|
130
|
+
- Read `main.md` for reasoning roadmap
|
|
131
|
+
- Read `log.md` for recent activity
|
|
132
|
+
- Read `theta.json` for coordination state
|
|
133
|
+
- List learnings directory for learning count
|
|
134
|
+
- Read `events.log.jsonl` for recent events.
|
|
135
|
+
|
|
136
|
+
Always report: "MCP server unreachable — using local .GCC/ fallback."
|