Skip to content

Refactor/metamo action - #8

Open
fevenissayas wants to merge 12 commits into
iCog-Labs-Dev:mainfrom
fevenissayas:refactor/metamo-action
Open

Refactor/metamo action#8
fevenissayas wants to merge 12 commits into
iCog-Labs-Dev:mainfrom
fevenissayas:refactor/metamo-action

Conversation

@fevenissayas

Copy link
Copy Markdown
Contributor

This pull request introduces a major refactor and expansion of the action modeling and candidate generation pipeline, centralizing action semantics and profiles, improving action risk handling, and simplifying/focusing the LLM client logic. It also removes legacy fallback code and consolidates action schema logic into a new core module. The changes are grouped into three main themes:

1. Action Modeling Refactor and Centralization

  • Introduced core/actions.py to define ActionSpec, ModeProfile, and ActionProfile dataclasses, along with canonical action definitions, aliases, and motivational profiles. This centralizes all action semantics, planning/execution instructions, and motivational mappings in a single location for consistent use across the codebase.
  • Removed the legacy llm/action_schema.py file, moving all action schema logic to core/actions.py.

2. Candidate Generation and Risk Handling Improvements

  • Replaced the old LLM candidate action generation with a new pipeline: the LLM now only returns contextual action risk overrides (get_action_risks_from_text), and candidate actions are constructed using the new build_candidate_actions function (from magus.candidates), which leverages the centralized action profiles and risk overrides. [1] [2] [3] [4]
  • Removed all local heuristic fallback logic for candidate generation and stimulus appraisal from llm/client.py, enforcing a single, consistent LLM-driven pipeline.

3. Codebase Simplification and Consistency

  • Updated the Action and Stimulus dataclasses in core/state.py to remove unused fields (e.g., delta_g from Action), and clarified type annotations. [1] [2] [3]
  • Refactored the chat assistant logic in llm/conversation.py for improved reliability and retry handling, and to use the new action schema interface from core/actions.py. [1] [2] [3]

These changes collectively make action handling more robust, maintainable, and extensible, and pave the way for more advanced motivational reasoning and action selection.

@Nahom32

Nahom32 commented Jul 8, 2026

Copy link
Copy Markdown
Member

@fevenissayas have you seen how it maps to other parts of the file as well since you touched the files in the core directory?

@fevenissayas

Copy link
Copy Markdown
Contributor Author

@fevenissayas have you seen how it maps to other parts of the file as well since you touched the files in the core directory?

@Nahom32 Yes, i changed it because the action definitions were duplicated across different parts of the system and created multiple sources of truth. I moved them into core so every component uses the same definitions. I also checked that the dependent modules still mapped correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants