1. Understand the Goal: The user wants a "knowledge graph" representing "developer productivity signals." This graph needs to support three specific use cases:
* Coaching Insights: Helping managers or AI coaches give better feedback.
* Experiment Design: Allowing teams to test changes (e.g., "Does reducing meetings increase code quality?").
* Accountability Dashboards: Visualizing performance and output for tracking goals.
-
Deconstruct the Domain (Developer Productivity):
- What is developer productivity? It's not just lines of code (LOC). It's a mix of velocity, quality, impact, and well-being (SPACE framework is a good mental model here: Satisfaction, Performance, Activity, Communication, Efficiency).
- What are the entities? Developers, Teams, Projects, Repositories, Tools (Jira, GitHub, Slack), Artifacts (PRs, Commits, Tickets), Concepts (Bug, Feature, Tech Debt).
-
Identify the Core Signals (The "Nodes"):
- Activity Signals: Commits, PRs opened/closed, tickets moved, lines changed.
- Flow/Efficiency Signals: Cycle time, lead time, PR review time, blocker duration.
- Quality Signals: Bug rate, test coverage, rollback frequency, code complexity.
- Collaboration Signals: Code review comments, meeting time, Slack response time, documentation contributions.
- *Well-being/Human Signals: Burnout indicators (late-night commits), PTO usage (or lack thereof).
-
Structure the Graph (The Schema/Ontology):
- I need to organize this logically. A standard taxonomy works well:
- Entities: The nouns.
- Relationships: The verbs/edges connecting nouns.
- Signals/Metrics: The quantifiable attributes attached to entities or relationships.
- Context/Dimensions: Time, Team, Project.
-
Drafting the Nodes and Edges (Iterative refinement):
- Entity: Developer -> Relationship: AUTHORED -> Entity: Commit
- Entity: Commit -> Relationship: PART_OF -> Entity: Pull Request (PR)
- Entity: PR -> Relationship: MODIFIES -> Entity: Codebase
- Entity: PR -> Relationship: BLOCKED_BY -> Entity: Review -> Metric: Time to Review
Let's categorize by the user's specific needs (Coaching, Experiments, Accountability).
- For Coaching: Needs granular, actionable links. "Late night work" -> "Risk of burnout". "Large PR size" -> "Difficulty reviewing".
- For Experiments: Needs variables (independent/dependent). Change X (process), measure Y (output).
- For Accountability: Needs aggregate roll-ups. Team velocity, Sprint burndown.
-
Developing the Graph Structure (The Output):
I will present this in a structured format: Entities, Relationships, and Attributes (Signals). I'll also group them by "Domains" (DORA, SPACE, etc.) to make it robust.
- Domain 1: Code Construction (The "What")
- Nodes: Commit, PR, Repo, File.
- Signals: Complexity, Churn, Size.
- Domain 2: Process & Flow (The "How")
- Nodes: Ticket, Sprint, Kanban Board.
- Signals: Cycle Time, Lead Time, WIP.
- Domain 3: Collaboration & Review (The "Who")
- Nodes: Review, Comment, Meeting.
- Signals: Review Depth, Time to First Response.
- Domain 4: Wellbeing & Reliability (The "Sustainability")
- Nodes: Incident, Deployment, Work Hours.
- Signals: Change Failure Rate, On-call Load.
-
Connecting to Use Cases:
- Coaching Insight Example: Link "High Code Churn" + "Long PR Review Time" -> Insight: "PRs are too complex; encourage smaller batches."
- Experiment Design: Independent Var: "Enforce WIP Limits". Dependent Var: "Cycle Time".
- Accountability: Team Performance Dashboard aggregation.
-
Refining the Format:
A text-based Mermaid diagram or a structured JSON/Schema description is best. I will provide a conceptual schema with specific examples of how to query it for the requested use cases.
Self-Correction during drafting: Don't just list metrics. A Knowledge Graph connects things. So, instead of just saying "Cycle Time," I must say: Ticket --(transitions to)--> Done State | Attribute: Duration (which is the Cycle Time).
-
Final Polish:
- Use standard industry frameworks (DORA, SPACE) as the foundation to ensure credibility.
- Add a section on "Signal Hygiene" (context is key).
- Visualize the relationships clearly.
-
Constructing the Response:
- Introduction: Define the scope (SPACE/DORA).
- The Ontology (Nodes & Edges): The core data model.
- The Signals (Attributes): The specific metrics attached to nodes.
- Application Layers: How to use the graph for Coaching, Experiments, and Dashboards.
- JSON Representation: A concrete example for developers.
(Self-Correction): Ensure I distinguish between Activity (doing things) and Outcome (value delivered). The graph needs to link Activity Nodes to Outcome Nodes.
Let's build the specific relationships:
Developer --[commits]--> CodeChange --[requires]--> Review --[blocks]--> Deployment.
This looks solid. I will structure the response to be immediately usable by a Data Engineer or Product Manager.
This knowledge graph is designed to move beyond simple "lines of code" metrics. It structures data to support the SPACE framework (Satisfaction, Performance, Activity, Communication, Efficiency) and DORA metrics.
It connects Raw Signals (system events) to Behavioral Concepts (human behaviors) to enable high-level coaching and strategic experimentation.
1. Graph Schema Overview (The Ontology)
The graph consists of four primary layers:
- The Actor Layer: Who is working? (Developers, Teams).
- The Artifact Layer: What are they working on? (Code, Tickets, Docs).
- The Event Layer: What happened? (Commits, Reviews, Deployments).
- The Concept Layer: What does this mean? (Friction, Flow, Burnout, Quality).
Visual Schema Representation
graph TD
%% Nodes
Developer[Actor: Developer]
Team[Actor: Team]
Repo[Artifact: Repository]
Ticket[Artifact: Ticket/Issue]
PR[Artifact: Pull Request]
Doc[Artifact: Document]
Commit[Event: Commit]
Review[Event: Code Review]
Deploy[Event: Deployment]
Meeting[Event: Meeting]
%% Relationships
Developer -- MEMBER_OF --> Team
Developer -- ASSIGNED_TO --> Ticket
Developer -- OPENS --> PR
Developer -- COMMITS --> Commit
Commit -- MODIFIES --> Repo
PR -- REFERENCES --> Ticket
PR -- TRIGGERS --> Review
Review -- BLOCKS --> PR
Deploy -- INCLUDES --> Commit
%% Signal Connections (The Insights)
Commit -- GENERATES --> Signal1[Signal: Coding Volume]
Review -- GENERATES --> Signal2[Signal: Review Thoroughness]
Deploy -- GENERATES --> Signal3[Signal: Deployment Frequency]
Meeting -- GENERATES --> Signal4[Signal: Focus Fragmentation]
%% Clustering into Concepts
Signal1 -- CONTRIBUTES_TO --> Concept1[Concept: Activity]
Signal2 -- CONTRIBUTES_TO --> Concept2[Concept: Quality]
Signal3 -- CONTRIBUTES_TO --> Concept3[Concept: Throughput]
Signal4 -- CONTRIBUTES_TO --> Concept4[Concept: Efficiency]
2. Detailed Node & Edge Definitions
This section details the specific attributes and mathematical relationships required to power the three use cases (Coaching, Experiments, Accountability).
A. The "Actor" Nodes
Developer
- Properties:
Seniority_Level, Tenure, Role (Backend, Frontend, Lead).
- Key Edges:
AUTHORED (Commit), COMMENTED_ON (PR), LOGGED (Meeting).
Team
- Properties:
Team_Type (Feature, Platform, SRE), Time_Zone_Distribution.
B. The "Signal" Nodes (Derived Metrics)
These are calculated nodes derived from raw events.
| Signal Name | Calculation Logic (Edges) | Maps To (Concept) |
|---|
| Cycle Time | PR_Merged_Timestamp MINUS First_Commit_Timestamp | Efficiency / Throughput |
| Review Depth | Count(Review_Comments) DIVIDED_BY Lines_of_Code_Changed | Quality / Collaboration |
| Focus Score | Count(Commits) MULTIPLIED_BY Average_Complexity DIVIDED_BY Calendar_Hours (minus meetings) | Flow / Deep Work |
| Bus Factor Risk | Count(Author) DIVIDED_BY Count(Total_Changes) for specific critical files | Risk / Knowledge Sharing |
| Rework Rate | Count(Reverted_Commits) PLUS Count(Bug_Fix_Commits) | Quality / Stability |
C. The "Concept" Nodes (Abstractions)
Friction: A weighted combination of high PR_Pickup_Time, high Context_Switching, and low Sentiment_Score.
Impact: Derived from Lines_Touched in high-value Ticket nodes (weighted by business priority).
3. Application Layer: How to Query the Graph
Here is how this graph structure powers your three specific requirements.
Use Case 1: Coaching Insights
Goal: Identify specific behavioral bottlenecks for an individual.
Graph Traversal:
- Start at
Developer: Alice.
- Traverse
AUTHORED relationships to PR nodes created in the last 30 days.
- Calculate average
PR_Size (Lines of Code).
- Traverse
PR -> TRIGGERS -> Review nodes.
- Check
Time_to_Approval property.
Insight Generation:
- Pattern: The graph shows Alice creates large PRs (>500 LOC) which correlate with long approval times (>24 hours).
- Coaching Recommendation: "Alice, your PRs are currently 3x larger than the team average. This is causing review bottlenecks. Try breaking work into smaller batches to increase velocity."
Use Case 2: Experiment Design (A/B Testing Process)
Goal: Test if a process change improves outcomes.
Scenario: The organization wants to test if "Enforcing WIP (Work In Progress) Limits" reduces Cycle Time.
Graph Structure for Experiment:
- Tag
Team_A (Control Group) and Team_B (Experimental Group).
- Apply
Policy: WIP_Limit_3 to Team_B.
- Pre-Intervention Measurement: Calculate baseline
Cycle_Time for both teams over 2 weeks.
- Post-Intervention Monitoring: Continuously ingest
Ticket transitions (In_Progress -> Done).
- Confounding Variable Check: Query
Meeting nodes to ensure Focus_Time wasn't accidentally increased in Team_B at the same time.
Result: The graph visualizes the correlation (or lack thereof) between the Policy node and the Efficiency concept node.
Use Case 3: Accountability Dashboards
Goal: Visualize team health and output without creating "vanity metrics".
Graph Traversal:
- Select
Team: Platform.
- Rollup all
Activity signals (Commits, Docs Updated) vs. Outcome signals (Deployments, Incidents Resolved).
- Compare against
SLA_Target nodes.
Dashboard View:
- Reliability (DORA): "Change Failure Rate is 5% (Target: <10%)" -> Green.
- Velocity: "Cycle Time is 4 days (Up from 3 days)" -> Yellow.
- Well-being: "After-hours commits increased by 20%" -> Red Alert (Burnout Risk).
4. Technical Implementation (JSON Example)
Here is a sample of how a node (Pull Request) and its relationships would be represented in a graph database (like Neo4j) or JSON-LD format to power this model.
{
"node_id": "pr-1024",
"type": "PullRequest",
"labels": ["Artifact", "WorkItem"],
"properties": {
"created_at": "2023-10-27T10:00:00Z",
"merged_at": "2023-10-28T14:00:00Z",
"lines_added": 450,
"lines_deleted": 20,
"complexity_score": "High"
},
"relationships": {
"AUTHORED_BY": "dev-alex",
"ASSIGNED_TO": "dev-sarah",
"REFERENCES_TICKET": "jira-500",
"MODIFIES_FILES": ["auth_service.py", "user_db_schema.sql"],
"TRIGGERS_BUILD": "jenkins-run-99"
},
"derived_signals": {
"cycle_time_hours": 28,
"is_large_pr": true,
"review_depth_score": 0.8
}
}