activating-expertise 0.1.0.dev0__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.
- activating_expertise-0.1.0.dev0.dist-info/METADATA +28 -0
- activating_expertise-0.1.0.dev0.dist-info/RECORD +61 -0
- activating_expertise-0.1.0.dev0.dist-info/WHEEL +5 -0
- activating_expertise-0.1.0.dev0.dist-info/entry_points.txt +2 -0
- activating_expertise-0.1.0.dev0.dist-info/licenses/LICENSE-DOCS +29 -0
- activating_expertise-0.1.0.dev0.dist-info/licenses/LICENSE-SOFTWARE +661 -0
- activating_expertise-0.1.0.dev0.dist-info/top_level.txt +1 -0
- ae/__init__.py +0 -0
- ae/analysis.py +193 -0
- ae/cli.py +496 -0
- ae/concept_server.py +209 -0
- ae/concept_viewer.py +640 -0
- ae/concepts.py +155 -0
- ae/core.py +1303 -0
- ae/dspy_xp.py +894 -0
- ae/graph.py +733 -0
- ae/guides/__init__.py +0 -0
- ae/guides/debugging.md +434 -0
- ae/guides/design_maturation.md +141 -0
- ae/guides/hygienator.md +334 -0
- ae/guides/landscape_review.md +175 -0
- ae/guides/model_evaluation.md +313 -0
- ae/guides/model_onboarding.md +386 -0
- ae/guides/operational_guide.md +869 -0
- ae/guides/process_improvement.md +296 -0
- ae/guides/quick_start.md +123 -0
- ae/guides/roadmap.md +443 -0
- ae/guides/synergistic_xp.md +416 -0
- ae/seed_concepts/__init__.py +1 -0
- ae/seed_concepts/ae-concept-context.jsonld +62 -0
- ae/seed_concepts/ai-keeping-up.jsonld +121 -0
- ae/seed_concepts/bc-activities.jsonld +97 -0
- ae/seed_concepts/bounded-rationality.jsonld +88 -0
- ae/seed_concepts/collaborative-agent.jsonld +91 -0
- ae/seed_concepts/coming-to-know.jsonld +123 -0
- ae/seed_concepts/complement.jsonld +360 -0
- ae/seed_concepts/comprehensibility-as-participation.jsonld +101 -0
- ae/seed_concepts/constellation-architecture.jsonld +136 -0
- ae/seed_concepts/decision-network.jsonld +120 -0
- ae/seed_concepts/design-maturation.jsonld +71 -0
- ae/seed_concepts/discourse-ontology.jsonld +126 -0
- ae/seed_concepts/divergence-regimes.jsonld +94 -0
- ae/seed_concepts/dominator-pattern.jsonld +103 -0
- ae/seed_concepts/emergent-paradigm-adoption.jsonld +107 -0
- ae/seed_concepts/epistemic-integrity.jsonld +102 -0
- ae/seed_concepts/human-universe.jsonld +154 -0
- ae/seed_concepts/kinship.jsonld +122 -0
- ae/seed_concepts/override-safety.jsonld +97 -0
- ae/seed_concepts/partnership.jsonld +136 -0
- ae/seed_concepts/persona-activation-as-ceremony.jsonld +130 -0
- ae/seed_concepts/process-as-medium.jsonld +102 -0
- ae/seed_concepts/process-selection.jsonld +71 -0
- ae/seed_concepts/tangent-as-signal.jsonld +85 -0
- ae/serve.py +192 -0
- ae/session_server.py +305 -0
- ae/sync.py +134 -0
- ae/teams/__init__.py +0 -0
- ae/teams/problem_solving.md +34 -0
- ae/teams/problem_solving_complete.md +735 -0
- ae/view.py +1357 -0
- ae/work.py +815 -0
ae/concept_server.py
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"""MCP server for AE concept retrieval.
|
|
2
|
+
|
|
3
|
+
Exposes concept_retrieve and concept_list tools for Claude Code
|
|
4
|
+
to access the team's shared concept store during sessions.
|
|
5
|
+
|
|
6
|
+
Run: python -m ae.concept_server [--concepts-dir PATH]
|
|
7
|
+
Configure in Claude Code: claude mcp add concept-server -- python -m ae.concept_server
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import json
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Annotated
|
|
17
|
+
|
|
18
|
+
from mcp.server.fastmcp import FastMCP
|
|
19
|
+
|
|
20
|
+
from ae.concepts import ConceptStore, load_concept_store, retrieve_concept
|
|
21
|
+
from ae.core import AEProject, find_project_root
|
|
22
|
+
|
|
23
|
+
# --- Server instructions (Lowin: this is the biggest lever for retrieval rate) ---
|
|
24
|
+
|
|
25
|
+
INSTRUCTIONS = """\
|
|
26
|
+
This server provides access to the team's shared concept store — \
|
|
27
|
+
concepts developed over multiple sessions with full context: \
|
|
28
|
+
per-persona interpretations, known issues, complement (what the concept hides), \
|
|
29
|
+
and boundary (what it includes/excludes and why).
|
|
30
|
+
|
|
31
|
+
Use concept_retrieve when:
|
|
32
|
+
- A user mentions a team concept by name ("dominator pattern", "bounded rationality", etc.)
|
|
33
|
+
- A user describes a situation that matches a known concept but doesn't name it \
|
|
34
|
+
(e.g., "the manager controls all information flow" matches "dominator pattern")
|
|
35
|
+
- A user asks about known issues, limitations, or critiques of a concept
|
|
36
|
+
- A user asks for a specific persona's perspective on a concept
|
|
37
|
+
- You want to incorporate substantive concept content into your response \
|
|
38
|
+
(not just the label, but sub-concepts, complement, issues, or persona interpretations)
|
|
39
|
+
|
|
40
|
+
Use concept_list at session start or when you're unsure what concepts are available.
|
|
41
|
+
|
|
42
|
+
Do NOT use concept_retrieve when:
|
|
43
|
+
- The discussion is about something clearly unrelated to any team concept \
|
|
44
|
+
(e.g., debugging a JSON parser, discussing syntax)
|
|
45
|
+
- You already have the concept's full content in context from an earlier retrieval
|
|
46
|
+
|
|
47
|
+
When you retrieve a concept, incorporate its content substantively — \
|
|
48
|
+
reference specific sub-concepts, persona interpretations, complement, \
|
|
49
|
+
or issues. Don't just say "that's a dominator pattern" — use the depth.\
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _find_concepts_dir(explicit_path: str | None = None) -> Path:
|
|
54
|
+
"""Find the concepts directory, checking explicit path, project, then seed concepts."""
|
|
55
|
+
if explicit_path:
|
|
56
|
+
p = Path(explicit_path)
|
|
57
|
+
if p.is_dir():
|
|
58
|
+
return p
|
|
59
|
+
|
|
60
|
+
# Try to find an ae project
|
|
61
|
+
root = find_project_root()
|
|
62
|
+
if root:
|
|
63
|
+
project = AEProject(root)
|
|
64
|
+
if project.concepts_path.is_dir() and any(project.concepts_path.glob("*.jsonld")):
|
|
65
|
+
return project.concepts_path
|
|
66
|
+
|
|
67
|
+
# Fall back to seed concepts bundled with the package
|
|
68
|
+
seed = Path(__file__).parent / "seed_concepts"
|
|
69
|
+
if seed.is_dir():
|
|
70
|
+
return seed
|
|
71
|
+
|
|
72
|
+
return Path(".")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _closest_matches(store: ConceptStore, term: str, max_results: int = 3) -> list[str]:
|
|
76
|
+
"""Find closest matching concept labels for a failed lookup."""
|
|
77
|
+
term_lower = term.lower()
|
|
78
|
+
scored = []
|
|
79
|
+
for label, concept_id in store._label_index.items():
|
|
80
|
+
# Simple substring and common-word matching
|
|
81
|
+
score = 0
|
|
82
|
+
if term_lower in label:
|
|
83
|
+
score += 3
|
|
84
|
+
elif label in term_lower:
|
|
85
|
+
score += 2
|
|
86
|
+
else:
|
|
87
|
+
term_words = set(term_lower.split())
|
|
88
|
+
label_words = set(label.split())
|
|
89
|
+
common = term_words & label_words
|
|
90
|
+
if common:
|
|
91
|
+
score += len(common)
|
|
92
|
+
if score > 0:
|
|
93
|
+
node = store.concepts[concept_id]
|
|
94
|
+
scored.append((score, node.pref_label))
|
|
95
|
+
|
|
96
|
+
# Deduplicate and sort
|
|
97
|
+
seen = set()
|
|
98
|
+
results = []
|
|
99
|
+
for _, label in sorted(scored, reverse=True):
|
|
100
|
+
if label not in seen:
|
|
101
|
+
seen.add(label)
|
|
102
|
+
results.append(label)
|
|
103
|
+
if len(results) >= max_results:
|
|
104
|
+
break
|
|
105
|
+
|
|
106
|
+
# If no fuzzy matches, just return all concept labels
|
|
107
|
+
if not results:
|
|
108
|
+
results = sorted(set(
|
|
109
|
+
store.concepts[cid].pref_label
|
|
110
|
+
for cid in store.concepts
|
|
111
|
+
))[:max_results]
|
|
112
|
+
|
|
113
|
+
return results
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def create_server(concepts_dir: Path) -> FastMCP:
|
|
117
|
+
"""Create and configure the MCP server."""
|
|
118
|
+
store = load_concept_store(concepts_dir)
|
|
119
|
+
print(f"Loaded {store.concept_count} concepts from {concepts_dir}", file=sys.stderr)
|
|
120
|
+
|
|
121
|
+
mcp = FastMCP(
|
|
122
|
+
"ae-concepts",
|
|
123
|
+
instructions=INSTRUCTIONS,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
@mcp.tool()
|
|
127
|
+
def concept_retrieve(
|
|
128
|
+
term: Annotated[str, "The concept name or alias to look up (e.g., 'dominator pattern', 'command-and-control culture')"],
|
|
129
|
+
persona: Annotated[str | None, "Optional persona name to foreground (e.g., 'Eisler', 'Chomsky'). Returns their interpretation prominently while still including all perspectives."] = None,
|
|
130
|
+
context: Annotated[str | None, "Optional context description for future semantic matching (not yet used, reserved for Phase 2)."] = None,
|
|
131
|
+
) -> str:
|
|
132
|
+
"""Retrieve a team concept with full context: shared kernel, per-persona interpretations, known issues, complement (what the concept hides), and boundary (what it includes/excludes).
|
|
133
|
+
|
|
134
|
+
Returns the complete five-part concept structure when a match is found,
|
|
135
|
+
or a structured "no match" response with closest available concepts.
|
|
136
|
+
"""
|
|
137
|
+
result = retrieve_concept(store, term, persona=persona)
|
|
138
|
+
|
|
139
|
+
if result is None:
|
|
140
|
+
closest = _closest_matches(store, term)
|
|
141
|
+
return json.dumps({
|
|
142
|
+
"status": "no_match",
|
|
143
|
+
"term": term,
|
|
144
|
+
"message": f"No concept found matching '{term}'.",
|
|
145
|
+
"available_concepts": closest,
|
|
146
|
+
"suggestion": "Try one of the available concepts, or rephrase your query."
|
|
147
|
+
}, indent=2)
|
|
148
|
+
|
|
149
|
+
return json.dumps({
|
|
150
|
+
"status": "found",
|
|
151
|
+
"term": term,
|
|
152
|
+
"concept": result,
|
|
153
|
+
}, indent=2)
|
|
154
|
+
|
|
155
|
+
@mcp.tool()
|
|
156
|
+
def concept_list() -> str:
|
|
157
|
+
"""List all available concepts in the store with their status and perspective count.
|
|
158
|
+
|
|
159
|
+
Call this at session start to know what team concepts are available,
|
|
160
|
+
or when unsure whether a concept exists in the store.
|
|
161
|
+
"""
|
|
162
|
+
if store.concept_count == 0:
|
|
163
|
+
return json.dumps({
|
|
164
|
+
"status": "empty",
|
|
165
|
+
"message": "No concepts loaded. The concept store is empty.",
|
|
166
|
+
"concepts": []
|
|
167
|
+
}, indent=2)
|
|
168
|
+
|
|
169
|
+
concepts = []
|
|
170
|
+
for concept_id in sorted(store.concepts.keys()):
|
|
171
|
+
node = store.concepts[concept_id]
|
|
172
|
+
concepts.append({
|
|
173
|
+
"label": node.pref_label,
|
|
174
|
+
"aliases": node.alt_labels,
|
|
175
|
+
"status": node.validity_status,
|
|
176
|
+
"perspectives": len(node.perspectives),
|
|
177
|
+
"open_issues": sum(
|
|
178
|
+
1 for i in node.issues
|
|
179
|
+
if i.get("ae:issueStatus") == "open"
|
|
180
|
+
),
|
|
181
|
+
"has_complement": bool(node.internal_complement or node.external_complement),
|
|
182
|
+
"has_boundary": bool(node.boundary),
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
return json.dumps({
|
|
186
|
+
"status": "ok",
|
|
187
|
+
"concept_count": store.concept_count,
|
|
188
|
+
"concepts": concepts,
|
|
189
|
+
}, indent=2)
|
|
190
|
+
|
|
191
|
+
return mcp
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def main():
|
|
195
|
+
parser = argparse.ArgumentParser(description="AE Concept MCP Server")
|
|
196
|
+
parser.add_argument(
|
|
197
|
+
"--concepts-dir",
|
|
198
|
+
help="Path to directory containing .jsonld concept files",
|
|
199
|
+
default=None,
|
|
200
|
+
)
|
|
201
|
+
args = parser.parse_args()
|
|
202
|
+
|
|
203
|
+
concepts_dir = _find_concepts_dir(args.concepts_dir)
|
|
204
|
+
server = create_server(concepts_dir)
|
|
205
|
+
server.run(transport="stdio")
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
if __name__ == "__main__":
|
|
209
|
+
main()
|