PlanOpticon

planopticon / video_processor / agent / skills / project_plan.py
Blame History Raw 75 lines
1
"""Skill: Generate a structured project plan from knowledge graph."""
2
3
from video_processor.agent.skills.base import (
4
AgentContext,
5
Artifact,
6
Skill,
7
register_skill,
8
)
9
10
11
def _group_entities_by_type(entities):
12
"""Group planning entities by their type."""
13
grouped = {}
14
for e in entities:
15
etype = getattr(e, "type", "unknown")
16
grouped.setdefault(etype, []).append(e)
17
return grouped
18
19
20
class ProjectPlanSkill(Skill):
21
name = "project_plan"
22
description = "Generate a structured project plan from knowledge graph"
23
24
def execute(self, context: AgentContext, **kwargs) -> Artifact:
25
stats = context.query_engine.stats()
26
entities = context.query_engine.entities()
27
relationships = context.query_engine.relationships()
28
grouped = _group_entities_by_type(context.planning_entities)
29
30
parts = [
31
"You are a project planning expert. Using the following "
32
"knowledge graph context, generate a comprehensive "
33
"project plan in markdown.",
34
"",
35
"## Knowledge Graph Overview",
36
stats.to_text(),
37
"",
38
"## Entities",
39
entities.to_text(),
40
"",
41
"## Relationships",
42
relationships.to_text(),
43
"",
44
"## Planning Entities (by type)",
45
]
46
for etype, elist in grouped.items():
47
parts.append(f"\n### {etype}")
48
for e in elist:
49
parts.append(f"- {e}")
50
51
parts.append(
52
"\nGenerate a markdown project plan with:\n"
53
"1. Executive Summary\n"
54
"2. Goals & Objectives\n"
55
"3. Scope\n"
56
"4. Phases & Milestones\n"
57
"5. Resource Requirements\n"
58
"6. Risks & Mitigations\n"
59
"7. Success Criteria\n\n"
60
"Return ONLY the markdown."
61
)
62
63
prompt = "\n".join(parts)
64
response = context.provider_manager.chat(messages=[{"role": "user", "content": prompt}])
65
66
return Artifact(
67
name="Project Plan",
68
content=response,
69
artifact_type="project_plan",
70
format="markdown",
71
)
72
73
74
register_skill(ProjectPlanSkill())
75

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button