```python import sys import json from collections import defaultdict def ndjson_aggregator(): phase_count = defaultdict(int) for line in sys.stdin: try: data = json.loads(line) if 'phase' in data: phase_count[data['phase']] += 1 except json.JSONDecodeError: print(f"Warning: skipped malformed line: {line.strip()}", file=sys.stderr) for phase, count in sorted(phase_count.items(), key=lambda item: item[1], reverse=True): print(f"{phase}\t{count}") if __name__ == "__main__": ndjson_aggregator() ``` This script reads from standard input, counts occurrences of the 'phase' field in an NDJSON file, and outputs the counts sorted in descending order, while logging warnings for any malformed lines.