benchside 0.4.1__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.
Files changed (178) hide show
  1. benchside/__init__.py +1 -0
  2. benchside/_content/app/SKILL.md +155 -0
  3. benchside/_content/app/references/app-api.md +261 -0
  4. benchside/_content/app/references/generic-agents.md +69 -0
  5. benchside/_content/app/references/metascience.md +346 -0
  6. benchside/_content/app/references/native-memory.md +429 -0
  7. benchside/_content/app/references/onboarding.md +313 -0
  8. benchside/_content/app/references/sharing.md +159 -0
  9. benchside/_content/app/scripts/benchside_app.py +311 -0
  10. benchside/_content/app-requirements.txt +197 -0
  11. benchside/_content/claude/bench-init/SKILL.md +37 -0
  12. benchside/_content/claude/bench-share/SKILL.md +44 -0
  13. benchside/_content/fixtures/.gitkeep +0 -0
  14. benchside/_content/legacy-skill-digests.json +26 -0
  15. benchside/_content/personas/journal-club.yaml +45 -0
  16. benchside/_content/personas/methods-clinic.yaml +49 -0
  17. benchside/_content/personas/peer-review.yaml +45 -0
  18. benchside/_content/personas/pi-hypothesis.yaml +121 -0
  19. benchside/_content/personas/pi.yaml +87 -0
  20. benchside/_content/personas/repro-check.yaml +45 -0
  21. benchside/_content/personas/results-meeting.yaml +46 -0
  22. benchside/_content/personas/study-design.yaml +50 -0
  23. benchside/_content/templates/app-role.md.tmpl +31 -0
  24. benchside/_content/templates/blocks/capture-contract.md +40 -0
  25. benchside/_content/templates/blocks/sovereignty.md +36 -0
  26. benchside/_content/templates/skill.md.tmpl +54 -0
  27. benchside/application/__init__.py +0 -0
  28. benchside/application/app.py +458 -0
  29. benchside/application/bridge.py +55 -0
  30. benchside/application/contributions.py +39 -0
  31. benchside/application/di.py +35 -0
  32. benchside/application/metascience.py +671 -0
  33. benchside/application/native.py +1088 -0
  34. benchside/application/packaging.py +19 -0
  35. benchside/application/sharing.py +439 -0
  36. benchside/application/submission_failures.py +28 -0
  37. benchside/cli/__init__.py +0 -0
  38. benchside/cli/hooks.py +159 -0
  39. benchside/cli/install.py +276 -0
  40. benchside/cli/journal.py +232 -0
  41. benchside/cli/main.py +761 -0
  42. benchside/cli/runtime.py +245 -0
  43. benchside/cli/sharing.py +66 -0
  44. benchside/cli/ui/__init__.py +5 -0
  45. benchside/cli/ui/_glyphs.py +21 -0
  46. benchside/cli/ui/_model.py +66 -0
  47. benchside/cli/ui/_renderer.py +110 -0
  48. benchside/cli/ui/_rich.py +75 -0
  49. benchside/config.py +122 -0
  50. benchside/domain/__init__.py +0 -0
  51. benchside/domain/authoring/__init__.py +0 -0
  52. benchside/domain/authoring/command/__init__.py +0 -0
  53. benchside/domain/authoring/command/compile.py +28 -0
  54. benchside/domain/authoring/model/__init__.py +0 -0
  55. benchside/domain/authoring/model/flow.py +27 -0
  56. benchside/domain/authoring/model/persona.py +56 -0
  57. benchside/domain/authoring/model/skill.py +32 -0
  58. benchside/domain/authoring/model/value.py +42 -0
  59. benchside/domain/authoring/port/__init__.py +5 -0
  60. benchside/domain/authoring/port/renderer.py +17 -0
  61. benchside/domain/authoring/port/repository.py +28 -0
  62. benchside/domain/authoring/port/skill_writer.py +19 -0
  63. benchside/domain/authoring/query/__init__.py +0 -0
  64. benchside/domain/authoring/query/get_persona.py +30 -0
  65. benchside/domain/authoring/query/list_personas.py +21 -0
  66. benchside/domain/authoring/service/__init__.py +0 -0
  67. benchside/domain/authoring/service/authoring.py +99 -0
  68. benchside/domain/authoring/util/__init__.py +0 -0
  69. benchside/domain/authoring/util/di/__init__.py +3 -0
  70. benchside/domain/authoring/util/di/provider.py +15 -0
  71. benchside/domain/consultation/__init__.py +0 -0
  72. benchside/domain/consultation/command/__init__.py +0 -0
  73. benchside/domain/consultation/command/capture_gap.py +28 -0
  74. benchside/domain/consultation/command/close.py +29 -0
  75. benchside/domain/consultation/command/open.py +36 -0
  76. benchside/domain/consultation/command/raise_critique.py +30 -0
  77. benchside/domain/consultation/command/record_decision.py +30 -0
  78. benchside/domain/consultation/command/resolve_critique.py +32 -0
  79. benchside/domain/consultation/command/state_hypothesis.py +28 -0
  80. benchside/domain/consultation/event/__init__.py +22 -0
  81. benchside/domain/consultation/event/closed.py +13 -0
  82. benchside/domain/consultation/event/critique_raised.py +12 -0
  83. benchside/domain/consultation/event/critique_resolved.py +12 -0
  84. benchside/domain/consultation/event/decision_recorded.py +13 -0
  85. benchside/domain/consultation/event/gap_observed.py +16 -0
  86. benchside/domain/consultation/event/hypothesis_stated.py +12 -0
  87. benchside/domain/consultation/event/opened.py +23 -0
  88. benchside/domain/consultation/event/question.py +16 -0
  89. benchside/domain/consultation/event/research_recorded.py +9 -0
  90. benchside/domain/consultation/model/__init__.py +0 -0
  91. benchside/domain/consultation/model/consultation.py +60 -0
  92. benchside/domain/consultation/model/project.py +78 -0
  93. benchside/domain/consultation/model/value.py +150 -0
  94. benchside/domain/consultation/port/__init__.py +6 -0
  95. benchside/domain/consultation/port/repository.py +32 -0
  96. benchside/domain/consultation/query/__init__.py +0 -0
  97. benchside/domain/consultation/query/get_consultation.py +28 -0
  98. benchside/domain/consultation/query/recall_project.py +97 -0
  99. benchside/domain/consultation/service/__init__.py +0 -0
  100. benchside/domain/consultation/service/consultation.py +373 -0
  101. benchside/domain/consultation/util/__init__.py +0 -0
  102. benchside/domain/consultation/util/di/__init__.py +3 -0
  103. benchside/domain/consultation/util/di/provider.py +33 -0
  104. benchside/domain/export/__init__.py +0 -0
  105. benchside/domain/export/command/__init__.py +0 -0
  106. benchside/domain/export/command/export_observations.py +31 -0
  107. benchside/domain/export/command/grant_consent.py +26 -0
  108. benchside/domain/export/command/revoke_consent.py +20 -0
  109. benchside/domain/export/event/__init__.py +19 -0
  110. benchside/domain/export/event/consent_granted.py +9 -0
  111. benchside/domain/export/event/consent_revoked.py +8 -0
  112. benchside/domain/export/event/observations_exported.py +12 -0
  113. benchside/domain/export/event/reporting.py +24 -0
  114. benchside/domain/export/model/__init__.py +0 -0
  115. benchside/domain/export/model/ledger.py +40 -0
  116. benchside/domain/export/model/metascience.py +418 -0
  117. benchside/domain/export/model/reporting.py +193 -0
  118. benchside/domain/export/model/value.py +79 -0
  119. benchside/domain/export/model/wire.py +104 -0
  120. benchside/domain/export/port/__init__.py +5 -0
  121. benchside/domain/export/port/redactor.py +27 -0
  122. benchside/domain/export/port/repository.py +25 -0
  123. benchside/domain/export/port/sink.py +19 -0
  124. benchside/domain/export/query/__init__.py +0 -0
  125. benchside/domain/export/query/consent_status.py +30 -0
  126. benchside/domain/export/query/preview_export.py +37 -0
  127. benchside/domain/export/service/__init__.py +0 -0
  128. benchside/domain/export/service/consent.py +53 -0
  129. benchside/domain/export/service/export.py +171 -0
  130. benchside/domain/export/service/reporting.py +281 -0
  131. benchside/domain/export/util/__init__.py +0 -0
  132. benchside/domain/export/util/di/__init__.py +3 -0
  133. benchside/domain/export/util/di/provider.py +22 -0
  134. benchside/domain/shared/__init__.py +0 -0
  135. benchside/domain/shared/command.py +44 -0
  136. benchside/domain/shared/error.py +51 -0
  137. benchside/domain/shared/event.py +46 -0
  138. benchside/domain/shared/model/__init__.py +31 -0
  139. benchside/domain/shared/model/aggregate.py +9 -0
  140. benchside/domain/shared/model/capture.py +33 -0
  141. benchside/domain/shared/model/entity.py +5 -0
  142. benchside/domain/shared/model/gap.py +89 -0
  143. benchside/domain/shared/model/ids.py +64 -0
  144. benchside/domain/shared/model/provenance.py +16 -0
  145. benchside/domain/shared/model/value.py +17 -0
  146. benchside/domain/shared/port/__init__.py +4 -0
  147. benchside/domain/shared/port/base.py +9 -0
  148. benchside/domain/shared/port/journal.py +36 -0
  149. benchside/domain/shared/query.py +42 -0
  150. benchside/domain/shared/service.py +31 -0
  151. benchside/infrastructure/__init__.py +9 -0
  152. benchside/infrastructure/content/__init__.py +0 -0
  153. benchside/infrastructure/content/loader.py +108 -0
  154. benchside/infrastructure/content/renderer.py +129 -0
  155. benchside/infrastructure/content/writer.py +26 -0
  156. benchside/infrastructure/files.py +43 -0
  157. benchside/infrastructure/http_sink.py +128 -0
  158. benchside/infrastructure/journal/__init__.py +0 -0
  159. benchside/infrastructure/journal/di.py +85 -0
  160. benchside/infrastructure/journal/projection.py +244 -0
  161. benchside/infrastructure/journal/registry.py +24 -0
  162. benchside/infrastructure/journal/store.py +134 -0
  163. benchside/infrastructure/placeholders.py +28 -0
  164. benchside/infrastructure/readable_records.py +211 -0
  165. benchside/infrastructure/readable_refresh.py +58 -0
  166. benchside/infrastructure/redaction.py +44 -0
  167. benchside/infrastructure/session_context.py +225 -0
  168. benchside/infrastructure/storage_layout.py +104 -0
  169. benchside/reporting.py +333 -0
  170. benchside/util/__init__.py +0 -0
  171. benchside/util/di/__init__.py +4 -0
  172. benchside/util/di/base.py +16 -0
  173. benchside/util/di/scope.py +18 -0
  174. benchside-0.4.1.dist-info/METADATA +97 -0
  175. benchside-0.4.1.dist-info/RECORD +178 -0
  176. benchside-0.4.1.dist-info/WHEEL +4 -0
  177. benchside-0.4.1.dist-info/entry_points.txt +2 -0
  178. benchside-0.4.1.dist-info/licenses/LICENSE +201 -0
benchside/reporting.py ADDED
@@ -0,0 +1,333 @@
1
+ """Offline aggregate report from operator-authorised R2 downloads.
2
+
3
+ Links new contributions by a pseudonymous store ID; emits aggregate counts only. Highest weekly
4
+ usage revisions replace earlier snapshots; repeated uploads never add counts.
5
+ """
6
+
7
+ import argparse
8
+ import json
9
+ from collections import Counter, defaultdict
10
+ from pathlib import Path
11
+
12
+ from benchside.domain.export.model.metascience import (
13
+ MANUAL_SAMPLING,
14
+ TextAnswer,
15
+ parse_activity,
16
+ parse_survey,
17
+ )
18
+ from benchside.domain.export.model.reporting import UsagePayload, parse_feedback
19
+ from benchside.domain.export.model.wire import validate_payload
20
+ from benchside.domain.shared.error import BenchsideError
21
+
22
+
23
+ def summarise(files):
24
+ gaps, feedback, usage, surveys, activity = {}, {}, {}, {}, {}
25
+ gap_contributors = {}
26
+ invalid, conflicts = 0, set()
27
+ for path in files:
28
+ try:
29
+ text = Path(path).read_text(encoding="utf-8")
30
+ data = json.loads(text)
31
+ schema = data.get("schema")
32
+ if schema in {"benchside.gaps.v1", "benchside.gaps.v2", "benchside.gaps.v3"}:
33
+ for item in validate_payload(text)["observations"]:
34
+ previous = gaps.get(item["id"])
35
+ if previous is not None and previous != item:
36
+ conflicts.add(("gaps", item["id"]))
37
+ owner = data.get("contributor_id")
38
+ if item["id"] in gap_contributors and gap_contributors[item["id"]] != owner:
39
+ conflicts.add(("gaps", item["id"]))
40
+ gap_contributors[item["id"]] = owner
41
+ gaps[item["id"]] = item
42
+ elif schema in {"benchside.feedback.v1", "benchside.feedback.v2"}:
43
+ parsed = parse_feedback(text)
44
+ existing = feedback.get(parsed.feedback.id)
45
+ if existing is not None and existing != parsed:
46
+ conflicts.add(("feedback", parsed.feedback.id))
47
+ feedback[parsed.feedback.id] = parsed
48
+ elif schema == "benchside.usage.v1":
49
+ parsed = UsagePayload.model_validate_json(text)
50
+ key = (parsed.installation_id, parsed.week)
51
+ previous = usage.get(key)
52
+ if previous and previous.revision == parsed.revision and previous != parsed:
53
+ conflicts.add(("usage", *key, parsed.revision))
54
+ if previous is None or parsed.revision > previous.revision:
55
+ usage[key] = parsed
56
+ elif schema in {"benchside.survey.v1", "benchside.survey.v2"}:
57
+ parsed = parse_survey(text)
58
+ previous = surveys.get(parsed.response_id)
59
+ if previous and previous != parsed:
60
+ conflicts.add(("survey", parsed.response_id))
61
+ surveys[parsed.response_id] = parsed
62
+ elif schema in {"benchside.activity.v1", "benchside.activity.v2"}:
63
+ parsed = parse_activity(text)
64
+ previous = activity.get(parsed.batch_id)
65
+ if previous and previous.sampling != parsed.sampling:
66
+ conflicts.add(("activity-method", parsed.batch_id))
67
+ if previous and getattr(previous, "contributor_id", None) != getattr(
68
+ parsed, "contributor_id", None
69
+ ):
70
+ conflicts.add(("activity-method", parsed.batch_id))
71
+ if previous and previous.revision == parsed.revision and previous != parsed:
72
+ conflicts.add(("activity", parsed.batch_id, parsed.revision))
73
+ if previous is None or parsed.revision > previous.revision:
74
+ activity[parsed.batch_id] = parsed
75
+ else:
76
+ invalid += 1
77
+ except (BenchsideError, OSError, ValueError, TypeError, AttributeError):
78
+ invalid += 1
79
+ gaps = {k: v for k, v in gaps.items() if ("gaps", k) not in conflicts}
80
+ feedback = {k: v for k, v in feedback.items() if ("feedback", k) not in conflicts}
81
+ usage = {
82
+ key: value
83
+ for key, value in usage.items()
84
+ if ("usage", *key, value.revision) not in conflicts
85
+ }
86
+ surveys = {k: v for k, v in surveys.items() if ("survey", k) not in conflicts}
87
+ activity = {
88
+ k: v
89
+ for k, v in activity.items()
90
+ if ("activity", k, v.revision) not in conflicts and ("activity-method", k) not in conflicts
91
+ }
92
+ survey_counts = Counter()
93
+ survey_text_counts = Counter()
94
+ activity_counts = Counter()
95
+ activity_contexts = Counter()
96
+ by_sampling = {}
97
+ for survey in surveys.values():
98
+ for question, answer in survey.answers.items():
99
+ if isinstance(answer, TextAnswer):
100
+ survey_text_counts[f"{survey.study_id}@{survey.study_version}/{question}"] += 1
101
+ continue
102
+ survey_counts[
103
+ f"{survey.study_id}@{survey.study_version}/{survey.study_sha256}/{question}/{answer}"
104
+ ] += 1
105
+ for batch in activity.values():
106
+ method = by_sampling.setdefault(
107
+ batch.sampling,
108
+ {
109
+ "batches": 0,
110
+ "coverage": Counter(),
111
+ "findings": Counter(),
112
+ },
113
+ )
114
+ method["batches"] += 1
115
+ method["coverage"].update(
116
+ {
117
+ "eligible_in_submitted_batches": batch.eligible,
118
+ "selected_in_submitted_batches": batch.selected,
119
+ "reviewed_and_shared": len(batch.observations),
120
+ }
121
+ )
122
+ for observation in batch.observations:
123
+ context = {"none": "outside_benchside", "unknown": "unknown"}.get(
124
+ observation.benchside_role, "benchside"
125
+ )
126
+ activity_contexts[context] += 1
127
+ findings = Counter()
128
+ for field in ("activity", "obstacle", "verification", "outcome"):
129
+ finding = getattr(observation, field)
130
+ findings[f"{field}/{finding.value}/{finding.basis}"] += 1
131
+ findings[f"benchside_role/{observation.benchside_role}"] += 1
132
+ findings[f"host/{observation.host}"] += 1
133
+ activity_counts.update(findings)
134
+ method["findings"].update(findings)
135
+ active = defaultdict(set)
136
+ uses = Counter()
137
+ weekly = defaultdict(lambda: Counter())
138
+ roles, hosts, app_versions, versions, errors = (
139
+ Counter(),
140
+ Counter(),
141
+ Counter(),
142
+ Counter(),
143
+ Counter(),
144
+ )
145
+ for (installation, week), report in usage.items():
146
+ for row in report.sessions:
147
+ if (
148
+ row.started
149
+ or row.concluded
150
+ or row.abandoned
151
+ or sum(row.records.model_dump().values())
152
+ ):
153
+ active[week].add(installation)
154
+ uses[installation] += row.started
155
+ roles[row.role] += row.started
156
+ hosts[f"{row.host}/{row.surface}"] += row.started
157
+ app_versions[f"{row.host}@{row.app_version}"] += row.started
158
+ versions[f"{report.benchside_version} / {row.role}@{row.role_version}"] += row.started
159
+ for field in ("started", "concluded", "abandoned"):
160
+ weekly[week][field] += getattr(row, field)
161
+ errors.update(report.errors)
162
+ # One demographic entry per participating installation, from its latest accepted
163
+ # weekly snapshot. The aggregate output does not expose per-store records.
164
+ latest = {}
165
+ for (installation, week), report in usage.items():
166
+ previous = latest.get(installation)
167
+ if previous is None or (week, report.revision) > (previous.week, previous.revision):
168
+ latest[installation] = report
169
+ demographic_counts = {"discipline": Counter(), "career_stage": Counter()}
170
+ for report in latest.values():
171
+ if report.demographics:
172
+ for field, value in report.demographics.model_dump(exclude_none=True).items():
173
+ for category in value if isinstance(value, list) else [value]:
174
+ demographic_counts[field][category] += 1
175
+ weeks_by_installation = Counter(i for installations in active.values() for i in installations)
176
+ contributors = {
177
+ "gaps": {gap_contributors[key] for key in gaps if gap_contributors.get(key)},
178
+ "feedback": {getattr(v, "contributor_id", None) for v in feedback.values()} - {None},
179
+ "usage": {key[0] for key in usage},
180
+ "surveys": {getattr(v, "contributor_id", None) for v in surveys.values()} - {None},
181
+ "activity": {getattr(v, "contributor_id", None) for v in activity.values()} - {None},
182
+ }
183
+ contributor_channels = Counter(
184
+ identifier for identifiers in contributors.values() for identifier in identifiers
185
+ )
186
+ gap_kind_contributors = defaultdict(set)
187
+ for key, item in gaps.items():
188
+ if gap_contributors.get(key):
189
+ gap_kind_contributors[item["gap"]["kind"]].add(gap_contributors[key])
190
+ return {
191
+ "workflow_observations": len(gaps),
192
+ "workflow_origins": dict(
193
+ sorted(Counter(o.get("origin", "legacy_unknown") for o in gaps.values()).items())
194
+ ),
195
+ "workflow_kinds": dict(sorted(Counter(o["gap"]["kind"] for o in gaps.values()).items())),
196
+ "contributing_stores": len(contributor_channels),
197
+ "contributing_stores_by_channel": {key: len(value) for key, value in contributors.items()},
198
+ "stores_contributing_multiple_channels": sum(n > 1 for n in contributor_channels.values()),
199
+ "contributing_stores_by_workflow_kind": {
200
+ key: len(value) for key, value in sorted(gap_kind_contributors.items())
201
+ },
202
+ "feedback_submissions": len(feedback),
203
+ "feedback_ease": dict(
204
+ sorted(Counter(str(f.feedback.ease) for f in feedback.values()).items())
205
+ ),
206
+ "feedback_repeat_intent": dict(
207
+ sorted(Counter(f.feedback.would_use_again for f in feedback.values()).items())
208
+ ),
209
+ "demographic_installations": sum(
210
+ bool(r.demographics and r.demographics.model_dump(exclude_none=True))
211
+ for r in latest.values()
212
+ ),
213
+ "installations_by_discipline": dict(sorted(demographic_counts["discipline"].items())),
214
+ "installations_by_career_stage": dict(sorted(demographic_counts["career_stage"].items())),
215
+ "active_installations": len(weeks_by_installation),
216
+ "returning_installations_across_weeks": sum(n >= 2 for n in weeks_by_installation.values()),
217
+ "installations_with_multiple_consultations": sum(n >= 2 for n in uses.values()),
218
+ "weekly": {
219
+ week: {"active_installations": len(active[week]), **dict(weekly[week])}
220
+ for week in sorted(set(active) | set(weekly))
221
+ },
222
+ "consultations_by_role": dict(sorted(roles.items())),
223
+ "consultations_by_app": dict(sorted(hosts.items())),
224
+ "consultations_by_app_version": dict(sorted(app_versions.items())),
225
+ "consultations_by_version": dict(sorted(versions.items())),
226
+ "failures": dict(sorted(errors.items())),
227
+ "survey_submissions": len(surveys),
228
+ "survey_answers": dict(sorted(survey_counts.items())),
229
+ "survey_free_text_responses": dict(sorted(survey_text_counts.items())),
230
+ "activity_batches": len(activity),
231
+ "activity_coverage": {
232
+ "eligible_in_submitted_batches": sum(b.eligible for b in activity.values()),
233
+ "selected_in_submitted_batches": sum(b.selected for b in activity.values()),
234
+ "reviewed_and_shared": sum(len(b.observations) for b in activity.values()),
235
+ },
236
+ "activity_findings": dict(sorted(activity_counts.items())),
237
+ "activity_contexts": dict(sorted(activity_contexts.items())),
238
+ "activity_by_sampling": {
239
+ key: {
240
+ "batches": value["batches"],
241
+ "coverage": dict(value["coverage"]),
242
+ "findings": dict(sorted(value["findings"].items())),
243
+ }
244
+ for key, value in sorted(by_sampling.items())
245
+ },
246
+ "invalid_files": invalid,
247
+ "conflicting_snapshots": len(conflicts),
248
+ "interpretation": "Opt-in stores/installations, not unique people or total adoption. New contributions can be linked by a random store ID after the updated explanation is accepted; legacy unlinked records remain unlinked. Workflow problems are the primary output; activity categories provide supporting context. Outside-Benchside conversations are not Benchside usage. Completion does not establish scientific benefit. Demographic buckets describe optional self-reports from each installation's latest accepted weekly snapshot, not population estimates. Activity totals pool submitted batches only; use activity_by_sampling to distinguish legacy percentage sampling, capped random selection and manual selection. Manual eligible counts describe only the researcher-chosen set, not a population denominator or frequency estimate. Random selection covers only the supplied accessible research inventory. Historical legacy samples may cover a partial week. Model-inferred findings and researcher-reported outcomes are distinct; review and nonresponse introduce selection bias. Validate the classifier on separately consented examples before making accuracy claims. These exploratory rollout findings are separate from the original paper evaluation.",
249
+ }
250
+
251
+
252
+ def markdown(report):
253
+ lines = [
254
+ "# Benchside rollout report",
255
+ "",
256
+ report["interpretation"],
257
+ "",
258
+ f"- Active installations: {report['active_installations']}",
259
+ f"- Returning across weeks: {report['returning_installations_across_weeks']}",
260
+ f"- Multiple consultations: {report['installations_with_multiple_consultations']}",
261
+ f"- Workflow observations: {report['workflow_observations']}",
262
+ f"- Feedback submissions: {report['feedback_submissions']}",
263
+ f"- Survey submissions: {report['survey_submissions']}",
264
+ f"- Research activity batches: {report['activity_batches']}",
265
+ f"- Invalid files: {report['invalid_files']}; conflicting snapshots: {report['conflicting_snapshots']}",
266
+ ]
267
+ for label, key in [
268
+ ("Weekly activity", "weekly"),
269
+ ("Workflow problems", "workflow_kinds"),
270
+ ("Contributing stores by workflow kind", "contributing_stores_by_workflow_kind"),
271
+ ("Workflow observation sources", "workflow_origins"),
272
+ ("Optional disciplines (installations; multiple choices allowed)", "installations_by_discipline"),
273
+ ("Optional career-stage buckets (installations)", "installations_by_career_stage"),
274
+ ("Roles used", "consultations_by_role"),
275
+ ("Apps used", "consultations_by_app"),
276
+ ("App versions", "consultations_by_app_version"),
277
+ ("Versions", "consultations_by_version"),
278
+ ("Ease of use (1–5)", "feedback_ease"),
279
+ ("Would use again", "feedback_repeat_intent"),
280
+ ("Failures", "failures"),
281
+ ("Survey answers (study/version/definition/question/answer)", "survey_answers"),
282
+ ("Pooled activity counts (submitted batches only)", "activity_coverage"),
283
+ ("Pooled activity findings and evidence basis", "activity_findings"),
284
+ ("Activity with and without Benchside roles", "activity_contexts"),
285
+ ]:
286
+ lines += ["", f"## {label}", "", "| Measure | Count |", "|---|---|"]
287
+ for name, value in report[key].items():
288
+ rendered = (
289
+ ", ".join(f"{k}: {v}" for k, v in value.items())
290
+ if isinstance(value, dict)
291
+ else str(value)
292
+ )
293
+ lines.append(f"| {name} | {rendered} |")
294
+ if not report[key]:
295
+ lines.append("| No reports yet | — |")
296
+ for method, values in report.get("activity_by_sampling", {}).items():
297
+ label = (
298
+ "Researcher-chosen conversations" if method == MANUAL_SAMPLING else "Random selection"
299
+ )
300
+ lines += ["", f"## {label}: {method}", ""]
301
+ if method == MANUAL_SAMPLING:
302
+ lines += [
303
+ "Eligible counts cover only the chosen set; no population frequency estimate.",
304
+ "",
305
+ ]
306
+ lines += ["| Measure | Count |", "|---|---|"]
307
+ for key, value in {
308
+ "batches": values["batches"],
309
+ **values["coverage"],
310
+ **values["findings"],
311
+ }.items():
312
+ lines.append(f"| {key} | {value} |")
313
+ return "\n".join(lines) + "\n"
314
+
315
+
316
+ def main(argv=None):
317
+ parser = argparse.ArgumentParser(description=__doc__)
318
+ parser.add_argument("inputs", type=Path, nargs="+")
319
+ parser.add_argument("--json", action="store_true")
320
+ args = parser.parse_args(argv)
321
+ files = sorted(
322
+ {
323
+ p
324
+ for source in args.inputs
325
+ for p in (source.rglob("*.json") if source.is_dir() else [source])
326
+ }
327
+ )
328
+ report = summarise(files)
329
+ print(json.dumps(report, indent=2) if args.json else markdown(report))
330
+
331
+
332
+ if __name__ == "__main__":
333
+ main()
File without changes
@@ -0,0 +1,4 @@
1
+ from benchside.util.di.base import Provider
2
+ from benchside.util.di.scope import Scope
3
+
4
+ __all__ = ["Provider", "Scope"]
@@ -0,0 +1,16 @@
1
+ """Base class for all benchside DI providers.
2
+
3
+ A single import point, so provider modules never import dishka directly and
4
+ cross-cutting metadata can be added here later without touching every domain.
5
+ """
6
+
7
+ from dishka import Provider as DishkaProvider
8
+
9
+
10
+ class Provider(DishkaProvider):
11
+ """Base for every provider in benchside.
12
+
13
+ Domain providers live in `benchside/domain/<name>/util/di/provider.py` and
14
+ bind that domain's services and handlers. Adapter providers live in
15
+ `benchside/adapters/<tech>/di.py` and bind ports to implementations.
16
+ """
@@ -0,0 +1,18 @@
1
+ """Dependency-injection scopes.
2
+
3
+ benchside is a CLI, not a server: there is no request. One `bench` invocation
4
+ is one unit of work.
5
+ """
6
+
7
+ from dishka import BaseScope, new_scope
8
+
9
+
10
+ class Scope(BaseScope): # type: ignore[misc] # BaseScope is designed to be subclassed
11
+ """Hierarchy: APP -> UOW
12
+
13
+ - APP: process lifetime (config, path resolution, template registry)
14
+ - UOW: one command or query execution (journal handle, services, handlers)
15
+ """
16
+
17
+ APP = new_scope("APP")
18
+ UOW = new_scope("UOW")
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.5
2
+ Name: benchside
3
+ Version: 0.4.1
4
+ Summary: Research colleagues with private project memory and optional workflow reporting.
5
+ Project-URL: Homepage, https://github.com/science-works/benchside
6
+ Project-URL: Documentation, https://github.com/science-works/benchside/blob/main/SETUP.md
7
+ Project-URL: Source, https://github.com/science-works/benchside
8
+ Project-URL: Issues, https://github.com/science-works/benchside/issues
9
+ Project-URL: Changelog, https://github.com/science-works/benchside/releases
10
+ Author-email: Rory Byrne <rory@rory.bio>
11
+ Maintainer: Science Works
12
+ License-Expression: Apache-2.0
13
+ License-File: LICENSE
14
+ Keywords: agents,research,research-journal,science
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Scientific/Engineering
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: dishka>=1.9.1
27
+ Requires-Dist: pydantic-settings>=2.12.0
28
+ Requires-Dist: pydantic>=2.12.4
29
+ Requires-Dist: pyyaml>=6.0.3
30
+ Requires-Dist: rich>=15.0.0
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Benchside
34
+
35
+ An AI workspace for doing science, maintained by **Science Works**. Benchside
36
+ provides eight research roles, private project records, saved decisions and
37
+ unresolved questions, and optional reviewed contributions to metascience research.
38
+
39
+ ## Install for a local agent
40
+
41
+ Requires **Python 3.11+ on macOS or Linux**. Python 3.11 and 3.14 are tested.
42
+ Benchside supplies the skills and runtime; your agent supplies the model and
43
+ execution tools. It works with capable agents using OpenAI, Anthropic, other
44
+ providers or locally hosted models.
45
+
46
+ With uv:
47
+
48
+ ```bash
49
+ uv tool install benchside
50
+ bench setup --agent codex
51
+ ```
52
+
53
+ Or install with pip in a Python virtual environment:
54
+
55
+ ```bash
56
+ python -m pip install benchside
57
+ bench setup --agent codex
58
+ ```
59
+
60
+ Use `--agent claude` for Claude Code. For another agent, use
61
+ `bench setup --agent generic --skills-dir /path/to/that/agents/skills` after
62
+ identifying its actual skill directory. The agent can run these steps for you.
63
+ Then ask it to read the installed Benchside skill and complete guided setup:
64
+ choose private storage, select a project, and verify saving and restoring a
65
+ synthetic record. Installing the Python package alone does not complete that setup.
66
+
67
+ The package is named **benchside**; its command is **bench**. Upgrade with
68
+ `uv tool upgrade benchside` or `python -m pip install --upgrade benchside`, then
69
+ rerun the same `bench setup` command to refresh the installed skill. Keep private
70
+ records in their existing location. Every app sharing a notebook upgraded by
71
+ 0.4.1 must use **0.4.1 or newer**, including apps previously running 0.4.0.
72
+
73
+ ## Research roles and records
74
+
75
+ - Research supervisor and focused hypothesis reviewer
76
+ - Study-design consultant and methods troubleshooter
77
+ - Results discussant and reproducibility auditor
78
+ - Journal-club discussant and scientific peer reviewer
79
+
80
+ The agent selects a suitable role with the researcher. Decisions and research
81
+ records remain in the chosen private store, with ODT/Markdown reading copies
82
+ for local storage. Optional sharing is disabled initially; scientific findings
83
+ are excluded from metascience submissions. Workflow problems require review and
84
+ approval. Survey participation is agreed before answering.
85
+
86
+ ## ChatGPT and Claude websites
87
+
88
+ This Python package does **not** install a web-app plugin or grant storage/network
89
+ permissions. For those apps, use the matching archive from
90
+ [GitHub Releases](https://github.com/science-works/benchside/releases/latest)
91
+ and follow the [setup guide](https://github.com/science-works/benchside/blob/main/SETUP.md).
92
+
93
+ [Source and full documentation](https://github.com/science-works/benchside) ·
94
+ [Report an issue](https://github.com/science-works/benchside/issues) ·
95
+ [Contribute a research role](https://github.com/science-works/benchside/blob/main/CONTRIBUTING.md)
96
+
97
+ Benchside is research software under active development, licensed under Apache 2.0.