Skip to content

Commit f1df921

Browse files
authored
Merge pull request #9 from Krigsexe/claude/refactor-ai-context-repo-01RAdfZ29yZdtD3CQQHCTL3Z
Claude/refactor ai context repo 01 r adf z29y zdt d3 cqqhctl3 z
2 parents 72c7b2a + 35c3199 commit f1df921

File tree

23 files changed

+448
-48
lines changed

23 files changed

+448
-48
lines changed

.odin/AI_CHECKPOINT.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"file_count": 34,
88
"sih_root": -5174629986412216191
99
},
10-
"last_backup": "/workspace/.odin/backups/20250824-013204",
10+
"last_backup": "/home/user/AI-Context-Engineering/.odin/backups/20251125-142938",
1111
"sih_root": 5740354900026072187,
1212
"risk_profile": "low",
1313
"commit": null,

agents/cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import json
1212
import logging
1313
import os
14-
import sys
1514
from pathlib import Path
1615
from typing import Optional
1716

@@ -125,7 +124,7 @@ def cmd_list(args):
125124
temp = object.__new__(agent_class)
126125
try:
127126
desc = agent_class.description.fget(temp)
128-
except:
127+
except Exception:
129128
desc = "No description"
130129
print(f" {agent_name:20} - {desc}")
131130

agents/cognitive/review.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ async def _assess_maintainability(
289289
# Calculate basic metrics
290290
lines = code.split('\n')
291291
total_lines = len(lines)
292-
code_lines = len([l for l in lines if l.strip() and not l.strip().startswith('#')])
293-
comment_lines = len([l for l in lines if l.strip().startswith('#')])
292+
code_lines = len([line for line in lines if line.strip() and not line.strip().startswith('#')])
293+
comment_lines = len([line for line in lines if line.strip().startswith('#')])
294294

295295
# Function/class count (basic)
296296
function_count = len(re.findall(r'\bdef\s+\w+', code))

agents/execution/security.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ async def _security_review(
257257

258258
code = input_data.get("code", "")
259259
language = input_data.get("language", "python")
260-
security_requirements = input_data.get("security_requirements", [])
260+
# Reserved for future use with custom security requirement checks
261+
_security_requirements = input_data.get("security_requirements", [])
261262

262263
if not code:
263264
return AgentResult(

agents/shared/base_agent.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
# =============================================================================
77

88
from __future__ import annotations
9-
import asyncio
109
import logging
1110
import uuid
1211
from abc import ABC, abstractmethod
1312
from dataclasses import dataclass, field
14-
from datetime import datetime
1513
from enum import Enum
1614
from typing import Any, Callable, Dict, List, Optional, Type
1715

agents/shared/integrity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def normalize_python_ast(source: str) -> str:
6262
6363
Preserving only structural semantics.
6464
"""
65-
source = textwrap.dedent(source)
66-
source = re.sub(r'^\s+', '', source, flags=re.MULTILINE)
65+
# Only dedent and strip leading/trailing whitespace, preserving internal indentation
66+
source = textwrap.dedent(source).strip()
6767
tree = ast.parse(source)
6868
return ast.dump(tree, annotate_fields=True, include_attributes=False)
6969

agents/shared/llm_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import os
88
import logging
9-
from typing import List, Dict, Any, Optional
9+
from typing import List, Dict, Any
1010

1111
from .providers import (
1212
BaseLLMProvider,

agents/shared/message_bus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import time
1111
import uuid
1212
import logging
13-
from dataclasses import dataclass, field, asdict
13+
from dataclasses import dataclass, field
1414
from typing import Any, Callable, Dict, List, Optional, AsyncIterator
1515
from enum import Enum
1616

agents/shared/providers/anthropic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class AnthropicProvider(BaseLLMProvider):
2424

2525
def __init__(
2626
self,
27-
api_key: str = None,
28-
model: str = None,
27+
api_key: Optional[str] = None,
28+
model: Optional[str] = None,
2929
timeout: int = 120
3030
):
3131
self.api_key = api_key or os.getenv("ANTHROPIC_API_KEY")

agents/shared/providers/base.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def generate(
4444
temperature: float = 0.2,
4545
max_tokens: int = 4096,
4646
stop: Optional[List[str]] = None,
47-
**kwargs
47+
**kwargs: Any
4848
) -> LLMResponse:
4949
"""
5050
Generate a response from the LLM.
@@ -91,7 +91,7 @@ def generate_with_retry(
9191
self,
9292
messages: List[Message],
9393
max_retries: int = 3,
94-
**kwargs
94+
**kwargs: Any
9595
) -> LLMResponse:
9696
"""
9797
Generate with automatic retry on failure.
@@ -107,15 +107,17 @@ def generate_with_retry(
107107
Raises:
108108
Exception: If all retries fail
109109
"""
110-
last_error = None
110+
last_error: Optional[Exception] = None
111111
for attempt in range(max_retries):
112112
try:
113113
return self.generate(messages, **kwargs)
114114
except Exception as e:
115115
last_error = e
116116
if attempt < max_retries - 1:
117117
time.sleep(2 ** attempt) # Exponential backoff
118-
raise last_error
118+
if last_error is not None:
119+
raise last_error
120+
raise RuntimeError("No retries attempted")
119121

120122
def count_tokens(self, text: str) -> int:
121123
"""

0 commit comments

Comments
 (0)