Skip to content

Ow/refactor context engineering#14

Open
perelloliver wants to merge 6 commits intomainfrom
ow/refactor_context_engineering
Open

Ow/refactor context engineering#14
perelloliver wants to merge 6 commits intomainfrom
ow/refactor_context_engineering

Conversation

@perelloliver
Copy link
Copy Markdown
Owner

@perelloliver perelloliver commented Dec 13, 2025

Implements #6 and #7 within the scope of role-only kata tailoring.
Need to raise tickets for employee-focused kata tailoring.

Changes made:

  • Rework context models to be lighter and development focused.
  • Introduces RoleInformation, Stack, and Technology models to lift specific information from contextual documents. Removes RoleInfo, Team, Role etc.
  • Update prompt engineering for summarisation.
  • Write into fn as opposed to class.
  • Restructure files.

High-level PR Summary

This PR refactors the context engineering system by introducing new lightweight models (RoleInformation, Stack, and Technology) to extract structured information from contextual documents. The changes replace the old class-based InformationExtractionPipeline with function-based implementations, reorganize the codebase from summariser to summarisation, improve prompt engineering for role-specific extraction, and add a centralized logging utility. The refactor aims to make the system more development-focused and maintainable.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 src/models.py
2 src/backend/utils.py
3 src/backend/__init__.py
4 src/backend/summarisation/__init__.py
5 src/backend/summarisation/role.py
6 src/backend/summarisation/run.py
7 src/backend/agent.py
8 src/backend/summariser/__init__.py
9 src/backend/summariser/pipeline.py
10 src/backend/summariser/run.py
11 src/backend/summariser/utils.py
12 src/backend/summariser/README.md
13 .gitignore
⚠️ Inconsistent Changes Detected
File Path Warning
.gitignore Adding .DS_STORE and sessions.json to gitignore appears to be unrelated cleanup that doesn't directly support the context engineering refactor theme

Need help? Join our Discord

Copy link
Copy Markdown

@recurseml recurseml Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on 7c5a214..ad44baa

  Severity     Location     Issue     Delete  
High src/backend/utils.py:48 Undefined variable reference error
High src/backend/utils.py:58 Undefined variable reference error
✅ Files analyzed, no issues (10)

.gitignore
src/backend/agent.py
src/backend/summarisation/role.py
src/backend/summarisation/run.py
src/backend/summariser/README.md
src/backend/summariser/__init__.py
src/backend/summariser/pipeline.py
src/backend/summariser/run.py
src/backend/summariser/utils.py
src/models.py

⏭️ Files skipped (2)
  Locations  
src/backend/__init__.py
src/backend/summarisation/__init__.py

Comment thread src/backend/utils.py Outdated
"""
documents = []
if not os.path.exists(directory_path):
logger.warning(f"Directory {directory_path} does not exist.")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NameError: undefined name 'logger' used in function. The function 'read_documents_from_directory' uses the variable 'logger' on lines 48 and 58, but this variable is never defined in the function scope or at module level. While the module defines a 'get_logger()' function that returns a logger instance, it is never called to create the 'logger' variable. When this function is called and the directory doesn't exist (line 48) or when a file read exception occurs (line 58), it will raise: NameError: name 'logger' is not defined. Fix: Add 'logger = get_logger(name)' at the module level (after imports) or at the start of the function.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

Comment thread src/backend/utils.py
with open(filepath, 'r', encoding='utf-8') as f:
documents.append(f.read())
except Exception as e:
logger.warning(f"Skipping file {filename}: {e}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NameError: undefined name 'logger' used in exception handler. The function 'read_documents_from_directory' uses the variable 'logger' on line 58 within an exception handler, but this variable is never defined in the function scope or at module level. While the module defines a 'get_logger()' function that returns a logger instance, it is never called to create the 'logger' variable. When a file read exception occurs, the code will raise: NameError: name 'logger' is not defined. This is the same root cause as the bug on line 48. Fix: Add 'logger = get_logger(name)' at the module level (after imports) or at the start of the function.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

@perelloliver perelloliver linked an issue Dec 13, 2025 that may be closed by this pull request
@perelloliver
Copy link
Copy Markdown
Owner Author

Note: This has not been integrated with the rest of the flow yet, it is part of an app-wide refactor.

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.

Context engineering

1 participant