-
Notifications
You must be signed in to change notification settings - Fork 36
Refactor: Unify skill/ralph abstractions to reduce duplication #514
Copy link
Copy link
Open
Labels
Description
ralph.py is nearly a line-for-line copy of discovery functions in skill.py, just with RALPH_MARKER instead of SKILL_MARKER. Similarly, write_skill_metadata and write_ralph_metadata in metadata.py differ only in the presence of a tool field.
Proposal
Introduce a ResourceType abstraction:
@dataclass(frozen=True)
class ResourceType:
marker: str # "SKILL.md" or "RALPH.md"
name: str # "skill" or "ralph"
has_tool_field: bool # skills are per-tool, ralphs are tool-agnosticThen parameterize shared functions on ResourceType rather than duplicating:
find_in_repo()/find_in_repo_listing()/discover_in_repo_listing()write_metadata()/stamp_metadata()
Skill-specific and ralph-specific modules can still exist but would delegate to the shared implementation.
Affected files
agr/skill.py— discovery functionsagr/ralph.py— near-duplicate discovery functionsagr/metadata.py—write_skill_metadatavswrite_ralph_metadata,stamp_skill_metadatavsstamp_ralph_metadataagr/fetcher.py— parallel install paths for skills and ralphs
Context
Identified in architecture audit: docs/contributing/architecture-audit.md
Reactions are currently unavailable